; LLVM IR from tangjz/acm-icpc :: lydsy (3501)

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

@sei = external dso_local global [4 x i32], align 16
@b = external dso_local global [4 x [7285 x i32]], align 16
@c = external dso_local global [7285 x i32], align 16
@f = external dso_local global [7285 x i32], align 16
@ex = external dso_local global i32, align 4
@ans = external dso_local global i32, align 4
@n = external dso_local global i64, align 8
@m = external dso_local global i64, align 8
@_ZL2pr = external hidden constant [4 x i32], align 16
@.str = external hidden unnamed_addr constant [9 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z5exgcdiiRiS_(i32 noundef, i32 noundef, ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #0

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #1 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i64, align 8
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %15

15:                                               ; preds = %115, %0
  %16 = load i32, ptr %2, align 4, !tbaa !5
  %17 = icmp slt i32 %16, 4
  br i1 %17, label %19, label %18

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

19:                                               ; preds = %15
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  %20 = load i32, ptr %2, align 4, !tbaa !5
  %21 = sext i32 %20 to i64
  %22 = getelementptr inbounds [4 x i32], ptr @_ZL2pr, i64 0, i64 %21
  %23 = load i32, ptr %22, align 4, !tbaa !5
  %24 = sdiv i32 999999598, %23
  %25 = load i32, ptr %2, align 4, !tbaa !5
  %26 = sext i32 %25 to i64
  %27 = getelementptr inbounds [4 x i32], ptr @_ZL2pr, i64 0, i64 %26
  %28 = load i32, ptr %27, align 4, !tbaa !5
  call void @_Z5exgcdiiRiS_(i32 noundef %24, i32 noundef %28, ptr noundef nonnull align 4 dereferenceable(4) %4, ptr noundef nonnull align 4 dereferenceable(4) %5)
  %29 = load i32, ptr %2, align 4, !tbaa !5
  %30 = sext i32 %29 to i64
  %31 = getelementptr inbounds [4 x i32], ptr @_ZL2pr, i64 0, i64 %30
  %32 = load i32, ptr %31, align 4, !tbaa !5
  %33 = sdiv i32 999999598, %32
  %34 = load i32, ptr %4, align 4, !tbaa !5
  %35 = icmp slt i32 %34, 0
  br i1 %35, label %36, label %38

36:                                               ; preds = %19
  %37 = load i32, ptr %4, align 4, !tbaa !5
  br label %45

38:                                               ; preds = %19
  %39 = load i32, ptr %4, align 4, !tbaa !5
  %40 = load i32, ptr %2, align 4, !tbaa !5
  %41 = sext i32 %40 to i64
  %42 = getelementptr inbounds [4 x i32], ptr @_ZL2pr, i64 0, i64 %41
  %43 = load i32, ptr %42, align 4, !tbaa !5
  %44 = add nsw i32 %39, %43
  br label %45

45:                                               ; preds = %38, %36
  %46 = phi i32 [ %37, %36 ], [ %44, %38 ]
  %47 = mul nsw i32 %33, %46
  %48 = load i32, ptr %2, align 4, !tbaa !5
  %49 = sext i32 %48 to i64
  %50 = getelementptr inbounds [4 x i32], ptr @sei, i64 0, i64 %49
  store i32 %47, ptr %50, align 4, !tbaa !5
  store i32 1, ptr @c, align 16, !tbaa !5
  %51 = load i32, ptr %2, align 4, !tbaa !5
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds [4 x [7285 x i32]], ptr @b, i64 0, i64 %52
  %54 = getelementptr inbounds [7285 x i32], ptr %53, i64 0, i64 0
  store i32 1, ptr %54, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  store i32 1, ptr %6, align 4, !tbaa !5
  br label %55

55:                                               ; preds = %111, %45
  %56 = load i32, ptr %6, align 4, !tbaa !5
  %57 = load i32, ptr %2, align 4, !tbaa !5
  %58 = sext i32 %57 to i64
  %59 = getelementptr inbounds [4 x i32], ptr @_ZL2pr, i64 0, i64 %58
  %60 = load i32, ptr %59, align 4, !tbaa !5
  %61 = icmp sle i32 %56, %60
  br i1 %61, label %63, label %62

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

63:                                               ; preds = %55
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  %64 = load i32, ptr @c, align 16, !tbaa !5
  store i32 %64, ptr %7, align 4, !tbaa !5
  %65 = load i32, ptr %6, align 4, !tbaa !5
  %66 = sub nsw i32 %65, 1
  %67 = sext i32 %66 to i64
  %68 = getelementptr inbounds [7285 x i32], ptr @c, i64 0, i64 %67
  %69 = load i32, ptr %68, align 4, !tbaa !5
  store i32 %69, ptr @c, align 16, !tbaa !5
  %70 = load i32, ptr %2, align 4, !tbaa !5
  %71 = sext i32 %70 to i64
  %72 = getelementptr inbounds [4 x [7285 x i32]], ptr @b, i64 0, i64 %71
  %73 = load i32, ptr %6, align 4, !tbaa !5
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds [7285 x i32], ptr %72, i64 0, i64 %74
  store i32 %69, ptr %75, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  store i32 1, ptr %8, align 4, !tbaa !5
  br label %76

76:                                               ; preds = %107, %63
  %77 = load i32, ptr %8, align 4, !tbaa !5
  %78 = load i32, ptr %6, align 4, !tbaa !5
  %79 = icmp sle i32 %77, %78
  br i1 %79, label %81, label %80

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

81:                                               ; preds = %76
  %82 = load i32, ptr %8, align 4, !tbaa !5
  %83 = sub nsw i32 %82, 1
  %84 = sext i32 %83 to i64
  %85 = getelementptr inbounds [7285 x i32], ptr @c, i64 0, i64 %84
  %86 = load i32, ptr %85, align 4, !tbaa !5
  %87 = load i32, ptr %7, align 4, !tbaa !5
  %88 = add nsw i32 %87, %86
  store i32 %88, ptr %7, align 4, !tbaa !5
  %89 = load i32, ptr %2, align 4, !tbaa !5
  %90 = sext i32 %89 to i64
  %91 = getelementptr inbounds [4 x i32], ptr @_ZL2pr, i64 0, i64 %90
  %92 = load i32, ptr %91, align 4, !tbaa !5
  %93 = icmp sge i32 %88, %92
  br i1 %93, label %94, label %102

94:                                               ; preds = %81
  %95 = load i32, ptr %2, align 4, !tbaa !5
  %96 = sext i32 %95 to i64
  %97 = getelementptr inbounds [4 x i32], ptr @_ZL2pr, i64 0, i64 %96
  %98 = load i32, ptr %97, align 4, !tbaa !5
  %99 = load i32, ptr %7, align 4, !tbaa !5
  %100 = sub nsw i32 %99, %98
  store i32 %100, ptr %7, align 4, !tbaa !5
  %101 = icmp ne i32 %100, 0
  br label %102

102:                                              ; preds = %94, %81
  %103 = phi i1 [ false, %81 ], [ %101, %94 ]
  %104 = load i32, ptr %8, align 4, !tbaa !5
  %105 = sext i32 %104 to i64
  %106 = getelementptr inbounds [7285 x i32], ptr @c, i64 0, i64 %105
  call void @_ZSt4swapIiENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 4 dereferenceable(4) %106, ptr noundef nonnull align 4 dereferenceable(4) %7) #6
  br label %107

107:                                              ; preds = %102
  %108 = load i32, ptr %8, align 4, !tbaa !5
  %109 = add nsw i32 %108, 1
  store i32 %109, ptr %8, align 4, !tbaa !5
  br label %76, !llvm.loop !9

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

111:                                              ; preds = %110
  %112 = load i32, ptr %6, align 4, !tbaa !5
  %113 = add nsw i32 %112, 1
  store i32 %113, ptr %6, align 4, !tbaa !5
  br label %55, !llvm.loop !11

114:                                              ; preds = %62
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  br label %115

115:                                              ; preds = %114
  %116 = load i32, ptr %2, align 4, !tbaa !5
  %117 = add nsw i32 %116, 1
  store i32 %117, ptr %2, align 4, !tbaa !5
  br label %15, !llvm.loop !12

118:                                              ; preds = %18
  %119 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n, ptr noundef @m)
  store i32 0, ptr @ex, align 4, !tbaa !5
  store i32 1, ptr @ans, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  store i32 0, ptr %9, align 4, !tbaa !5
  br label %120

120:                                              ; preds = %247, %118
  %121 = load i32, ptr %9, align 4, !tbaa !5
  %122 = icmp slt i32 %121, 4
  br i1 %122, label %124, label %123

123:                                              ; preds = %120
  store i32 11, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  br label %250

124:                                              ; preds = %120
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  %125 = load i64, ptr @n, align 8, !tbaa !13
  store i64 %125, ptr %10, align 8, !tbaa !13
  %126 = load i32, ptr %9, align 4, !tbaa !5
  %127 = sext i32 %126 to i64
  %128 = getelementptr inbounds [4 x [7285 x i32]], ptr @b, i64 0, i64 %127
  %129 = getelementptr inbounds [7285 x i32], ptr %128, i64 0, i64 0
  %130 = load i32, ptr %9, align 4, !tbaa !5
  %131 = sext i32 %130 to i64
  %132 = getelementptr inbounds [4 x i32], ptr @_ZL2pr, i64 0, i64 %131
  %133 = load i32, ptr %132, align 4, !tbaa !5
  %134 = add nsw i32 %133, 1
  %135 = sext i32 %134 to i64
  %136 = mul i64 %135, 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 @f, ptr align 4 %129, i64 %136, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  store i32 0, ptr %11, align 4, !tbaa !5
  br label %137

137:                                              ; preds = %223, %124
  %138 = load i64, ptr %10, align 8, !tbaa !13
  %139 = icmp sgt i64 %138, 0
  br i1 %139, label %141, label %140

140:                                              ; preds = %137
  store i32 14, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  br label %233

141:                                              ; preds = %137
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #6
  store i32 0, ptr %12, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #6
  %142 = load i64, ptr %10, align 8, !tbaa !13
  %143 = load i32, ptr %9, align 4, !tbaa !5
  %144 = sext i32 %143 to i64
  %145 = getelementptr inbounds [4 x i32], ptr @_ZL2pr, i64 0, i64 %144
  %146 = load i32, ptr %145, align 4, !tbaa !5
  %147 = sext i32 %146 to i64
  %148 = srem i64 %142, %147
  %149 = trunc i64 %148 to i32
  store i32 %149, ptr %13, align 4, !tbaa !5
  br label %150

150:                                              ; preds = %219, %141
  %151 = load i32, ptr %12, align 4, !tbaa !5
  %152 = load i32, ptr %13, align 4, !tbaa !5
  %153 = icmp slt i32 %151, %152
  br i1 %153, label %155, label %154

154:                                              ; preds = %150
  store i32 17, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  br label %222

155:                                              ; preds = %150
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #6
  store i32 0, ptr %14, align 4, !tbaa !5
  br label %156

156:                                              ; preds = %185, %155
  %157 = load i32, ptr %14, align 4, !tbaa !5
  %158 = load i32, ptr %9, align 4, !tbaa !5
  %159 = sext i32 %158 to i64
  %160 = getelementptr inbounds [4 x i32], ptr @_ZL2pr, i64 0, i64 %159
  %161 = load i32, ptr %160, align 4, !tbaa !5
  %162 = icmp slt i32 %157, %161
  br i1 %162, label %164, label %163

163:                                              ; preds = %156
  store i32 20, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #6
  br label %188

164:                                              ; preds = %156
  %165 = load i32, ptr %11, align 4, !tbaa !5
  %166 = load i32, ptr %14, align 4, !tbaa !5
  %167 = sext i32 %166 to i64
  %168 = getelementptr inbounds [7285 x i32], ptr @f, i64 0, i64 %167
  %169 = load i32, ptr %168, align 4, !tbaa !5
  %170 = mul nsw i32 %165, %169
  %171 = load i32, ptr %14, align 4, !tbaa !5
  %172 = add nsw i32 %171, 1
  %173 = sext i32 %172 to i64
  %174 = getelementptr inbounds [7285 x i32], ptr @f, i64 0, i64 %173
  %175 = load i32, ptr %174, align 4, !tbaa !5
  %176 = add nsw i32 %170, %175
  %177 = load i32, ptr %9, align 4, !tbaa !5
  %178 = sext i32 %177 to i64
  %179 = getelementptr inbounds [4 x i32], ptr @_ZL2pr, i64 0, i64 %178
  %180 = load i32, ptr %179, align 4, !tbaa !5
  %181 = srem i32 %176, %180
  %182 = load i32, ptr %14, align 4, !tbaa !5
  %183 = sext i32 %182 to i64
  %184 = getelementptr inbounds [7285 x i32], ptr @f, i64 0, i64 %183
  store i32 %181, ptr %184, align 4, !tbaa !5
  br label %185

185:                                              ; preds = %164
  %186 = load i32, ptr %14, align 4, !tbaa !5
  %187 = add nsw i32 %186, 1
  store i32 %187, ptr %14, align 4, !tbaa !5
  br label %156, !llvm.loop !15

188:                                              ; preds = %163
  %189 = load i32, ptr @f, align 16, !tbaa !5
  %190 = load i32, ptr getelementptr inbounds ([7285 x i32], ptr @f, i64 0, i64 1), align 4, !tbaa !5
  %191 = add nsw i32 %189, %190
  %192 = load i32, ptr %9, align 4, !tbaa !5
  %193 = sext i32 %192 to i64
  %194 = getelementptr inbounds [4 x i32], ptr @_ZL2pr, i64 0, i64 %193
  %195 = load i32, ptr %194, align 4, !tbaa !5
  %196 = sext i32 %195 to i64
  %197 = getelementptr inbounds [7285 x i32], ptr @f, i64 0, i64 %196
  store i32 %191, ptr %197, align 4, !tbaa !5
  %198 = load i32, ptr %9, align 4, !tbaa !5
  %199 = sext i32 %198 to i64
  %200 = getelementptr inbounds [4 x i32], ptr @_ZL2pr, i64 0, i64 %199
  %201 = load i32, ptr %200, align 4, !tbaa !5
  %202 = icmp sge i32 %191, %201
  br i1 %202, label %203, label %217

203:                                              ; preds = %188
  %204 = load i32, ptr %9, align 4, !tbaa !5
  %205 = sext i32 %204 to i64
  %206 = getelementptr inbounds [4 x i32], ptr @_ZL2pr, i64 0, i64 %205
  %207 = load i32, ptr %206, align 4, !tbaa !5
  %208 = load i32, ptr %9, align 4, !tbaa !5
  %209 = sext i32 %208 to i64
  %210 = getelementptr inbounds [4 x i32], ptr @_ZL2pr, i64 0, i64 %209
  %211 = load i32, ptr %210, align 4, !tbaa !5
  %212 = sext i32 %211 to i64
  %213 = getelementptr inbounds [7285 x i32], ptr @f, i64 0, i64 %212
  %214 = load i32, ptr %213, align 4, !tbaa !5
  %215 = sub nsw i32 %214, %207
  store i32 %215, ptr %213, align 4, !tbaa !5
  %216 = icmp ne i32 %215, 0
  br label %217

217:                                              ; preds = %203, %188
  %218 = phi i1 [ false, %188 ], [ %216, %203 ]
  br label %219

219:                                              ; preds = %217
  %220 = load i32, ptr %12, align 4, !tbaa !5
  %221 = add nsw i32 %220, 1
  store i32 %221, ptr %12, align 4, !tbaa !5
  br label %150, !llvm.loop !16

222:                                              ; preds = %154
  br label %223

223:                                              ; preds = %222
  %224 = load i32, ptr %9, align 4, !tbaa !5
  %225 = sext i32 %224 to i64
  %226 = getelementptr inbounds [4 x i32], ptr @_ZL2pr, i64 0, i64 %225
  %227 = load i32, ptr %226, align 4, !tbaa !5
  %228 = sext i32 %227 to i64
  %229 = load i64, ptr %10, align 8, !tbaa !13
  %230 = sdiv i64 %229, %228
  store i64 %230, ptr %10, align 8, !tbaa !13
  %231 = load i32, ptr %11, align 4, !tbaa !5
  %232 = add nsw i32 %231, 1
  store i32 %232, ptr %11, align 4, !tbaa !5
  br label %137, !llvm.loop !17

233:                                              ; preds = %140
  %234 = load i32, ptr @ex, align 4, !tbaa !5
  %235 = sext i32 %234 to i64
  %236 = load i32, ptr %9, align 4, !tbaa !5
  %237 = sext i32 %236 to i64
  %238 = getelementptr inbounds [4 x i32], ptr @sei, i64 0, i64 %237
  %239 = load i32, ptr %238, align 4, !tbaa !5
  %240 = sext i32 %239 to i64
  %241 = load i32, ptr @f, align 16, !tbaa !5
  %242 = sext i32 %241 to i64
  %243 = mul nsw i64 %240, %242
  %244 = add nsw i64 %235, %243
  %245 = srem i64 %244, 999999598
  %246 = trunc i64 %245 to i32
  store i32 %246, ptr @ex, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  br label %247

247:                                              ; preds = %233
  %248 = load i32, ptr %9, align 4, !tbaa !5
  %249 = add nsw i32 %248, 1
  store i32 %249, ptr %9, align 4, !tbaa !5
  br label %120, !llvm.loop !18

250:                                              ; preds = %123
  %251 = load i64, ptr @m, align 8, !tbaa !13
  %252 = srem i64 %251, 999999599
  store i64 %252, ptr @m, align 8, !tbaa !13
  br label %253

253:                                              ; preds = %270, %250
  %254 = load i32, ptr @ex, align 4, !tbaa !5
  %255 = icmp sgt i32 %254, 0
  br i1 %255, label %256, label %277

256:                                              ; preds = %253
  %257 = load i32, ptr @ex, align 4, !tbaa !5
  %258 = and i32 %257, 1
  %259 = icmp ne i32 %258, 0
  br i1 %259, label %260, label %268

260:                                              ; preds = %256
  %261 = load i32, ptr @ans, align 4, !tbaa !5
  %262 = sext i32 %261 to i64
  %263 = load i64, ptr @m, align 8, !tbaa !13
  %264 = mul nsw i64 %262, %263
  %265 = srem i64 %264, 999999599
  %266 = trunc i64 %265 to i32
  store i32 %266, ptr @ans, align 4, !tbaa !5
  %267 = icmp ne i32 %266, 0
  br label %268

268:                                              ; preds = %260, %256
  %269 = phi i1 [ false, %256 ], [ %267, %260 ]
  br label %270

270:                                              ; preds = %268
  %271 = load i32, ptr @ex, align 4, !tbaa !5
  %272 = ashr i32 %271, 1
  store i32 %272, ptr @ex, align 4, !tbaa !5
  %273 = load i64, ptr @m, align 8, !tbaa !13
  %274 = load i64, ptr @m, align 8, !tbaa !13
  %275 = mul nsw i64 %273, %274
  %276 = srem i64 %275, 999999599
  store i64 %276, ptr @m, align 8, !tbaa !13
  br label %253, !llvm.loop !19

277:                                              ; preds = %253
  %278 = load i32, ptr @ans, align 4, !tbaa !5
  %279 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, i32 noundef %278)
  ret i32 0
}

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZSt4swapIiENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #3

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

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

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

declare i32 @printf(ptr noundef, ...) #4

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


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

@sei = external dso_local local_unnamed_addr global [4 x i32], align 16
@b = external dso_local local_unnamed_addr global [4 x [7285 x i32]], align 16
@c = external dso_local global [7285 x i32], align 16
@f = external dso_local local_unnamed_addr global [7285 x i32], align 16
@ex = external dso_local local_unnamed_addr global i32, align 4
@ans = external dso_local local_unnamed_addr global i32, align 4
@n = external dso_local global i64, align 8
@m = external dso_local global i64, align 8
@_ZL2pr = external hidden local_unnamed_addr constant [4 x i32], align 16
@.str = external hidden unnamed_addr constant [9 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z5exgcdiiRiS_(i32 noundef, i32 noundef, ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #0

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #1 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #7
  %4 = load i32, ptr @_ZL2pr, align 16, !tbaa !5
  %5 = sdiv i32 999999598, %4
  call void @_Z5exgcdiiRiS_(i32 noundef %5, i32 noundef %4, ptr noundef nonnull align 4 dereferenceable(4) %1, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %6 = load i32, ptr %1, align 4, !tbaa !5
  %7 = icmp slt i32 %6, 0
  %8 = select i1 %7, i32 0, i32 %4
  %9 = add nsw i32 %8, %6
  %10 = mul nsw i32 %9, %5
  store i32 %10, ptr @sei, align 16, !tbaa !5
  store i32 1, ptr @c, align 16, !tbaa !5
  store i32 1, ptr @b, align 16, !tbaa !5
  %.not6269 = icmp slt i32 %4, 1
  br i1 %.not6269, label %._crit_edge, label %.lr.ph.preheader

.split.preheader:                                 ; preds = %._crit_edge.3
  %11 = add nsw i32 %4, 1
  %12 = sext i32 %11 to i64
  %13 = shl nsw i64 %12, 2
  call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 16 @f, ptr nonnull align 16 @b, i64 %13, i1 false)
  %14 = load i32, ptr @sei, align 16, !tbaa !5
  %15 = sext i32 %14 to i64
  %16 = load i32, ptr @f, align 16, !tbaa !5
  %17 = sext i32 %16 to i64
  %18 = mul nsw i64 %17, %15
  %19 = srem i64 %18, 999999598
  %20 = add nsw i32 %119, 1
  %21 = sext i32 %20 to i64
  %22 = shl nsw i64 %21, 2
  call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 16 @f, ptr nonnull align 4 getelementptr inbounds (i8, ptr @b, i64 29140), i64 %22, i1 false)
  %23 = load i32, ptr getelementptr inbounds (i8, ptr @sei, i64 4), align 4, !tbaa !5
  %24 = sext i32 %23 to i64
  %25 = load i32, ptr @f, align 16, !tbaa !5
  %26 = sext i32 %25 to i64
  %27 = mul nsw i64 %26, %24
  %28 = add nsw i64 %27, %19
  %29 = srem i64 %28, 999999598
  %30 = add nsw i32 %141, 1
  %31 = sext i32 %30 to i64
  %32 = shl nsw i64 %31, 2
  call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 16 @f, ptr nonnull align 8 getelementptr inbounds (i8, ptr @b, i64 58280), i64 %32, i1 false)
  %33 = load i32, ptr getelementptr inbounds (i8, ptr @sei, i64 8), align 8, !tbaa !5
  %34 = sext i32 %33 to i64
  %35 = load i32, ptr @f, align 16, !tbaa !5
  %36 = sext i32 %35 to i64
  %37 = mul nsw i64 %36, %34
  %38 = add nsw i64 %37, %29
  %39 = srem i64 %38, 999999598
  %40 = add nsw i32 %163, 1
  %41 = sext i32 %40 to i64
  %42 = shl nsw i64 %41, 2
  call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 16 @f, ptr nonnull align 4 getelementptr inbounds (i8, ptr @b, i64 87420), i64 %42, i1 false)
  %43 = load i32, ptr getelementptr inbounds (i8, ptr @sei, i64 12), align 4, !tbaa !5
  %44 = sext i32 %43 to i64
  %45 = load i32, ptr @f, align 16, !tbaa !5
  %46 = sext i32 %45 to i64
  %47 = mul nsw i64 %46, %44
  %48 = add nsw i64 %47, %39
  %49 = srem i64 %48, 999999598
  br label %.split90.us

.lr.ph81.us:                                      ; preds = %._crit_edge.3, %._crit_edge82.us
  %indvars.iv128 = phi i64 [ %indvars.iv.next129, %._crit_edge82.us ], [ 0, %._crit_edge.3 ]
  %50 = phi i64 [ %86, %._crit_edge82.us ], [ 0, %._crit_edge.3 ]
  %51 = getelementptr inbounds [4 x [7285 x i32]], ptr @b, i64 0, i64 %indvars.iv128
  %52 = getelementptr inbounds [4 x i32], ptr @_ZL2pr, i64 0, i64 %indvars.iv128
  %53 = load i32, ptr %52, align 4, !tbaa !5
  %.fr = freeze i32 %53
  %54 = add nsw i32 %.fr, 1
  %55 = sext i32 %54 to i64
  %56 = shl nsw i64 %55, 2
  call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 16 @f, ptr nonnull align 4 %51, i64 %56, i1 false)
  %57 = sext i32 %.fr to i64
  %58 = icmp sgt i32 %.fr, 0
  %59 = getelementptr inbounds [7285 x i32], ptr @f, i64 0, i64 %57
  br i1 %58, label %.lr.ph81.split.us.us.preheader, label %.lr.ph81.split.us88

.lr.ph81.split.us.us.preheader:                   ; preds = %.lr.ph81.us
  %wide.trip.count = zext nneg i32 %.fr to i64
  %xtraiter144 = and i64 %wide.trip.count, 1
  %60 = icmp eq i32 %.fr, 1
  %unroll_iter146 = and i64 %wide.trip.count, 2147483646
  %lcmp.mod145.not = icmp eq i64 %xtraiter144, 0
  br label %.lr.ph81.split.us.us

.lr.ph81.split.us88:                              ; preds = %.lr.ph81.us, %._crit_edge76.split.us
  %.05077.us85 = phi i64 [ %62, %._crit_edge76.split.us ], [ %186, %.lr.ph81.us ]
  %61 = srem i64 %.05077.us85, %57
  %62 = sdiv i64 %.05077.us85, %57
  %63 = icmp sgt i64 %61, 0
  br i1 %63, label %.preheader.us.preheader, label %._crit_edge76.split.us

.preheader.us.preheader:                          ; preds = %.lr.ph81.split.us88
  %64 = trunc nsw i64 %61 to i32
  %smax = call i32 @llvm.smax.i32(i32 %64, i32 1)
  %xtraiter = and i32 %smax, 1
  %65 = icmp eq i64 %61, 1
  br i1 %65, label %._crit_edge76.split.us.loopexit.unr-lcssa, label %.preheader.us.preheader.new

.preheader.us.preheader.new:                      ; preds = %.preheader.us.preheader
  %unroll_iter = and i32 %smax, 2147483646
  br label %.preheader.us

._crit_edge76.split.us.loopexit.unr-lcssa:        ; preds = %.preheader.us, %.preheader.us.preheader
  %lcmp.mod.not = icmp eq i32 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge76.split.us, label %.preheader.us.epil

.preheader.us.epil:                               ; preds = %._crit_edge76.split.us.loopexit.unr-lcssa
  %66 = load i32, ptr @f, align 16, !tbaa !5
  %67 = load i32, ptr getelementptr inbounds (i8, ptr @f, i64 4), align 4, !tbaa !5
  %68 = add nsw i32 %67, %66
  %.not61.us.epil = icmp slt i32 %68, %.fr
  %69 = select i1 %.not61.us.epil, i32 0, i32 %.fr
  %spec.select67.us.epil = sub nsw i32 %68, %69
  store i32 %spec.select67.us.epil, ptr %59, align 4, !tbaa !5
  br label %._crit_edge76.split.us

._crit_edge76.split.us:                           ; preds = %.preheader.us.epil, %._crit_edge76.split.us.loopexit.unr-lcssa, %.lr.ph81.split.us88
  %70 = icmp sgt i64 %62, 0
  br i1 %70, label %.lr.ph81.split.us88, label %._crit_edge82.us, !llvm.loop !9

.preheader.us:                                    ; preds = %.preheader.us, %.preheader.us.preheader.new
  %niter = phi i32 [ 0, %.preheader.us.preheader.new ], [ %niter.next.1, %.preheader.us ]
  %71 = load i32, ptr @f, align 16, !tbaa !5
  %72 = load i32, ptr getelementptr inbounds (i8, ptr @f, i64 4), align 4, !tbaa !5
  %73 = add nsw i32 %72, %71
  %.not61.us = icmp slt i32 %73, %.fr
  %74 = select i1 %.not61.us, i32 0, i32 %.fr
  %spec.select67.us = sub nsw i32 %73, %74
  store i32 %spec.select67.us, ptr %59, align 4, !tbaa !5
  %75 = load i32, ptr @f, align 16, !tbaa !5
  %76 = load i32, ptr getelementptr inbounds (i8, ptr @f, i64 4), align 4, !tbaa !5
  %77 = add nsw i32 %76, %75
  %.not61.us.1 = icmp slt i32 %77, %.fr
  %78 = select i1 %.not61.us.1, i32 0, i32 %.fr
  %spec.select67.us.1 = sub nsw i32 %77, %78
  store i32 %spec.select67.us.1, ptr %59, align 4, !tbaa !5
  %niter.next.1 = add i32 %niter, 2
  %niter.ncmp.1 = icmp eq i32 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %._crit_edge76.split.us.loopexit.unr-lcssa, label %.preheader.us, !llvm.loop !11

._crit_edge82.us:                                 ; preds = %._crit_edge76.split.us, %._crit_edge76.split.us.us.us
  %79 = getelementptr inbounds [4 x i32], ptr @sei, i64 0, i64 %indvars.iv128
  %80 = load i32, ptr %79, align 4, !tbaa !5
  %81 = sext i32 %80 to i64
  %82 = load i32, ptr @f, align 16, !tbaa !5
  %83 = sext i32 %82 to i64
  %84 = mul nsw i64 %83, %81
  %85 = add nsw i64 %84, %50
  %86 = srem i64 %85, 999999598
  %indvars.iv.next129 = add nuw nsw i64 %indvars.iv128, 1
  %exitcond131.not = icmp eq i64 %indvars.iv.next129, 4
  br i1 %exitcond131.not, label %.split90.us, label %.lr.ph81.us, !llvm.loop !12

.lr.ph81.split.us.us:                             ; preds = %.lr.ph81.split.us.us.preheader, %._crit_edge76.split.us.us.us
  %.04978.us.us = phi i32 [ %91, %._crit_edge76.split.us.us.us ], [ 0, %.lr.ph81.split.us.us.preheader ]
  %.05077.us.us = phi i64 [ %88, %._crit_edge76.split.us.us.us ], [ %186, %.lr.ph81.split.us.us.preheader ]
  %87 = urem i64 %.05077.us.us, %57
  %88 = udiv i64 %.05077.us.us, %57
  %89 = trunc nuw nsw i64 %87 to i32
  %90 = icmp sgt i64 %87, 0
  br i1 %90, label %.preheader.us.us.us, label %._crit_edge76.split.us.us.us

._crit_edge76.split.us.us.us:                     ; preds = %._crit_edge74.us.us.us, %.lr.ph81.split.us.us
  %91 = add nuw nsw i32 %.04978.us.us, 1
  %92 = icmp sgt i64 %88, 0
  br i1 %92, label %.lr.ph81.split.us.us, label %._crit_edge82.us, !llvm.loop !9

.preheader.us.us.us:                              ; preds = %.lr.ph81.split.us.us, %._crit_edge74.us.us.us
  %.04875.us.us.us = phi i32 [ %116, %._crit_edge74.us.us.us ], [ 0, %.lr.ph81.split.us.us ]
  %.pre = load i32, ptr @f, align 16, !tbaa !5
  br i1 %60, label %._crit_edge74.us.us.us.unr-lcssa, label %.preheader.us.us.us.new

.preheader.us.us.us.new:                          ; preds = %.preheader.us.us.us, %.preheader.us.us.us.new
  %93 = phi i32 [ %103, %.preheader.us.us.us.new ], [ %.pre, %.preheader.us.us.us ]
  %indvars.iv124 = phi i64 [ %indvars.iv.next125.1, %.preheader.us.us.us.new ], [ 0, %.preheader.us.us.us ]
  %niter147 = phi i64 [ %niter147.next.1, %.preheader.us.us.us.new ], [ 0, %.preheader.us.us.us ]
  %94 = getelementptr inbounds [7285 x i32], ptr @f, i64 0, i64 %indvars.iv124
  %95 = mul nsw i32 %93, %.04978.us.us
  %indvars.iv.next125 = or disjoint i64 %indvars.iv124, 1
  %96 = getelementptr inbounds [7285 x i32], ptr @f, i64 0, i64 %indvars.iv.next125
  %97 = load i32, ptr %96, align 4, !tbaa !5
  %98 = add nsw i32 %95, %97
  %99 = srem i32 %98, %.fr
  store i32 %99, ptr %94, align 8, !tbaa !5
  %100 = getelementptr inbounds [7285 x i32], ptr @f, i64 0, i64 %indvars.iv.next125
  %101 = mul nsw i32 %97, %.04978.us.us
  %indvars.iv.next125.1 = add nuw nsw i64 %indvars.iv124, 2
  %102 = getelementptr inbounds [7285 x i32], ptr @f, i64 0, i64 %indvars.iv.next125.1
  %103 = load i32, ptr %102, align 8, !tbaa !5
  %104 = add nsw i32 %101, %103
  %105 = srem i32 %104, %.fr
  store i32 %105, ptr %100, align 4, !tbaa !5
  %niter147.next.1 = add i64 %niter147, 2
  %niter147.ncmp.1 = icmp eq i64 %niter147.next.1, %unroll_iter146
  br i1 %niter147.ncmp.1, label %._crit_edge74.us.us.us.unr-lcssa, label %.preheader.us.us.us.new, !llvm.loop !13

._crit_edge74.us.us.us.unr-lcssa:                 ; preds = %.preheader.us.us.us.new, %.preheader.us.us.us
  %.unr = phi i32 [ %.pre, %.preheader.us.us.us ], [ %103, %.preheader.us.us.us.new ]
  %indvars.iv124.unr = phi i64 [ 0, %.preheader.us.us.us ], [ %indvars.iv.next125.1, %.preheader.us.us.us.new ]
  br i1 %lcmp.mod145.not, label %._crit_edge74.us.us.us, label %._crit_edge74.us.us.us.epilog-lcssa

._crit_edge74.us.us.us.epilog-lcssa:              ; preds = %._crit_edge74.us.us.us.unr-lcssa
  %106 = getelementptr inbounds [7285 x i32], ptr @f, i64 0, i64 %indvars.iv124.unr
  %107 = mul nsw i32 %.unr, %.04978.us.us
  %indvars.iv.next125.epil = add nuw nsw i64 %indvars.iv124.unr, 1
  %108 = getelementptr inbounds [7285 x i32], ptr @f, i64 0, i64 %indvars.iv.next125.epil
  %109 = load i32, ptr %108, align 4, !tbaa !5
  %110 = add nsw i32 %107, %109
  %111 = srem i32 %110, %.fr
  store i32 %111, ptr %106, align 4, !tbaa !5
  br label %._crit_edge74.us.us.us

._crit_edge74.us.us.us:                           ; preds = %._crit_edge74.us.us.us.unr-lcssa, %._crit_edge74.us.us.us.epilog-lcssa
  %112 = load i32, ptr @f, align 16, !tbaa !5
  %113 = load i32, ptr getelementptr inbounds (i8, ptr @f, i64 4), align 4, !tbaa !5
  %114 = add nsw i32 %113, %112
  %.not61.us.us.us = icmp slt i32 %114, %.fr
  %115 = select i1 %.not61.us.us.us, i32 0, i32 %.fr
  %spec.select67.us.us.us = sub nsw i32 %114, %115
  store i32 %spec.select67.us.us.us, ptr %59, align 4, !tbaa !5
  %116 = add nuw nsw i32 %.04875.us.us.us, 1
  %117 = icmp slt i32 %116, %89
  br i1 %117, label %.preheader.us.us.us, label %._crit_edge76.split.us.us.us, !llvm.loop !11

.lr.ph.preheader:                                 ; preds = %0
  %118 = add nuw i32 %4, 1
  %wide.trip.count113 = zext i32 %118 to i64
  br label %.lr.ph

._crit_edge:                                      ; preds = %193, %0
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #7
  %119 = load i32, ptr getelementptr inbounds (i8, ptr @_ZL2pr, i64 4), align 4, !tbaa !5
  %120 = sdiv i32 999999598, %119
  call void @_Z5exgcdiiRiS_(i32 noundef %120, i32 noundef %119, ptr noundef nonnull align 4 dereferenceable(4) %1, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %121 = load i32, ptr %1, align 4, !tbaa !5
  %122 = icmp slt i32 %121, 0
  %123 = select i1 %122, i32 0, i32 %119
  %124 = add nsw i32 %123, %121
  %125 = mul nsw i32 %124, %120
  store i32 %125, ptr getelementptr inbounds (i8, ptr @sei, i64 4), align 4, !tbaa !5
  store i32 1, ptr @c, align 16, !tbaa !5
  store i32 1, ptr getelementptr inbounds (i8, ptr @b, i64 29140), align 4, !tbaa !5
  %.not6269.1 = icmp slt i32 %119, 1
  br i1 %.not6269.1, label %._crit_edge.1, label %.lr.ph.preheader.1

.lr.ph.preheader.1:                               ; preds = %._crit_edge
  %126 = add nuw i32 %119, 1
  %wide.trip.count113.1 = zext i32 %126 to i64
  br label %.lr.ph.1

.lr.ph.1:                                         ; preds = %140, %.lr.ph.preheader.1
  %indvars.iv108.1 = phi i64 [ 1, %.lr.ph.preheader.1 ], [ %indvars.iv.next109.1, %140 ]
  %indvars.iv106.1 = phi i64 [ 2, %.lr.ph.preheader.1 ], [ %indvars.iv.next107.1, %140 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #7
  %127 = load i32, ptr @c, align 16, !tbaa !5
  store i32 %127, ptr %3, align 4, !tbaa !5
  %128 = add nsw i64 %indvars.iv108.1, -1
  %129 = getelementptr inbounds [7285 x i32], ptr @c, i64 0, i64 %128
  %130 = load i32, ptr %129, align 4, !tbaa !5
  store i32 %130, ptr @c, align 16, !tbaa !5
  %131 = getelementptr inbounds [4 x [7285 x i32]], ptr @b, i64 0, i64 1, i64 %indvars.iv108.1
  store i32 %130, ptr %131, align 4, !tbaa !5
  br label %132

132:                                              ; preds = %132, %.lr.ph.1
  %indvars.iv.1 = phi i64 [ 1, %.lr.ph.1 ], [ %indvars.iv.next.1, %132 ]
  %133 = add nsw i64 %indvars.iv.1, -1
  %134 = getelementptr inbounds [7285 x i32], ptr @c, i64 0, i64 %133
  %135 = load i32, ptr %134, align 4, !tbaa !5
  %136 = load i32, ptr %3, align 4, !tbaa !5
  %137 = add nsw i32 %136, %135
  %.not64.1 = icmp slt i32 %137, %119
  %138 = select i1 %.not64.1, i32 0, i32 %119
  %spec.select.1 = sub nsw i32 %137, %138
  store i32 %spec.select.1, ptr %3, align 4, !tbaa !5
  %139 = getelementptr inbounds [7285 x i32], ptr @c, i64 0, i64 %indvars.iv.1
  call void @_ZSt4swapIiENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 4 dereferenceable(4) %139, ptr noundef nonnull align 4 dereferenceable(4) %3) #7
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv.1, 1
  %exitcond.1.not = icmp eq i64 %indvars.iv.next.1, %indvars.iv106.1
  br i1 %exitcond.1.not, label %140, label %132, !llvm.loop !14

140:                                              ; preds = %132
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #7
  %indvars.iv.next109.1 = add nuw nsw i64 %indvars.iv108.1, 1
  %indvars.iv.next107.1 = add nuw nsw i64 %indvars.iv106.1, 1
  %exitcond114.1.not = icmp eq i64 %indvars.iv.next109.1, %wide.trip.count113.1
  br i1 %exitcond114.1.not, label %._crit_edge.1, label %.lr.ph.1, !llvm.loop !15

._crit_edge.1:                                    ; preds = %140, %._crit_edge
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #7
  %141 = load i32, ptr getelementptr inbounds (i8, ptr @_ZL2pr, i64 8), align 8, !tbaa !5
  %142 = sdiv i32 999999598, %141
  call void @_Z5exgcdiiRiS_(i32 noundef %142, i32 noundef %141, ptr noundef nonnull align 4 dereferenceable(4) %1, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %143 = load i32, ptr %1, align 4, !tbaa !5
  %144 = icmp slt i32 %143, 0
  %145 = select i1 %144, i32 0, i32 %141
  %146 = add nsw i32 %145, %143
  %147 = mul nsw i32 %146, %142
  store i32 %147, ptr getelementptr inbounds (i8, ptr @sei, i64 8), align 8, !tbaa !5
  store i32 1, ptr @c, align 16, !tbaa !5
  store i32 1, ptr getelementptr inbounds (i8, ptr @b, i64 58280), align 8, !tbaa !5
  %.not6269.2 = icmp slt i32 %141, 1
  br i1 %.not6269.2, label %._crit_edge.2, label %.lr.ph.preheader.2

.lr.ph.preheader.2:                               ; preds = %._crit_edge.1
  %148 = add nuw i32 %141, 1
  %wide.trip.count113.2 = zext i32 %148 to i64
  br label %.lr.ph.2

.lr.ph.2:                                         ; preds = %162, %.lr.ph.preheader.2
  %indvars.iv108.2 = phi i64 [ 1, %.lr.ph.preheader.2 ], [ %indvars.iv.next109.2, %162 ]
  %indvars.iv106.2 = phi i64 [ 2, %.lr.ph.preheader.2 ], [ %indvars.iv.next107.2, %162 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #7
  %149 = load i32, ptr @c, align 16, !tbaa !5
  store i32 %149, ptr %3, align 4, !tbaa !5
  %150 = add nsw i64 %indvars.iv108.2, -1
  %151 = getelementptr inbounds [7285 x i32], ptr @c, i64 0, i64 %150
  %152 = load i32, ptr %151, align 4, !tbaa !5
  store i32 %152, ptr @c, align 16, !tbaa !5
  %153 = getelementptr inbounds [4 x [7285 x i32]], ptr @b, i64 0, i64 2, i64 %indvars.iv108.2
  store i32 %152, ptr %153, align 4, !tbaa !5
  br label %154

154:                                              ; preds = %154, %.lr.ph.2
  %indvars.iv.2 = phi i64 [ 1, %.lr.ph.2 ], [ %indvars.iv.next.2, %154 ]
  %155 = add nsw i64 %indvars.iv.2, -1
  %156 = getelementptr inbounds [7285 x i32], ptr @c, i64 0, i64 %155
  %157 = load i32, ptr %156, align 4, !tbaa !5
  %158 = load i32, ptr %3, align 4, !tbaa !5
  %159 = add nsw i32 %158, %157
  %.not64.2 = icmp slt i32 %159, %141
  %160 = select i1 %.not64.2, i32 0, i32 %141
  %spec.select.2 = sub nsw i32 %159, %160
  store i32 %spec.select.2, ptr %3, align 4, !tbaa !5
  %161 = getelementptr inbounds [7285 x i32], ptr @c, i64 0, i64 %indvars.iv.2
  call void @_ZSt4swapIiENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 4 dereferenceable(4) %161, ptr noundef nonnull align 4 dereferenceable(4) %3) #7
  %indvars.iv.next.2 = add nuw nsw i64 %indvars.iv.2, 1
  %exitcond.2.not = icmp eq i64 %indvars.iv.next.2, %indvars.iv106.2
  br i1 %exitcond.2.not, label %162, label %154, !llvm.loop !14

162:                                              ; preds = %154
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #7
  %indvars.iv.next109.2 = add nuw nsw i64 %indvars.iv108.2, 1
  %indvars.iv.next107.2 = add nuw nsw i64 %indvars.iv106.2, 1
  %exitcond114.2.not = icmp eq i64 %indvars.iv.next109.2, %wide.trip.count113.2
  br i1 %exitcond114.2.not, label %._crit_edge.2, label %.lr.ph.2, !llvm.loop !15

._crit_edge.2:                                    ; preds = %162, %._crit_edge.1
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #7
  %163 = load i32, ptr getelementptr inbounds (i8, ptr @_ZL2pr, i64 12), align 4, !tbaa !5
  %164 = sdiv i32 999999598, %163
  call void @_Z5exgcdiiRiS_(i32 noundef %164, i32 noundef %163, ptr noundef nonnull align 4 dereferenceable(4) %1, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %165 = load i32, ptr %1, align 4, !tbaa !5
  %166 = icmp slt i32 %165, 0
  %167 = select i1 %166, i32 0, i32 %163
  %168 = add nsw i32 %167, %165
  %169 = mul nsw i32 %168, %164
  store i32 %169, ptr getelementptr inbounds (i8, ptr @sei, i64 12), align 4, !tbaa !5
  store i32 1, ptr @c, align 16, !tbaa !5
  store i32 1, ptr getelementptr inbounds (i8, ptr @b, i64 87420), align 4, !tbaa !5
  %.not6269.3 = icmp slt i32 %163, 1
  br i1 %.not6269.3, label %._crit_edge.3, label %.lr.ph.preheader.3

.lr.ph.preheader.3:                               ; preds = %._crit_edge.2
  %170 = add nuw i32 %163, 1
  %wide.trip.count113.3 = zext i32 %170 to i64
  br label %.lr.ph.3

.lr.ph.3:                                         ; preds = %184, %.lr.ph.preheader.3
  %indvars.iv108.3 = phi i64 [ 1, %.lr.ph.preheader.3 ], [ %indvars.iv.next109.3, %184 ]
  %indvars.iv106.3 = phi i64 [ 2, %.lr.ph.preheader.3 ], [ %indvars.iv.next107.3, %184 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #7
  %171 = load i32, ptr @c, align 16, !tbaa !5
  store i32 %171, ptr %3, align 4, !tbaa !5
  %172 = add nsw i64 %indvars.iv108.3, -1
  %173 = getelementptr inbounds [7285 x i32], ptr @c, i64 0, i64 %172
  %174 = load i32, ptr %173, align 4, !tbaa !5
  store i32 %174, ptr @c, align 16, !tbaa !5
  %175 = getelementptr inbounds [4 x [7285 x i32]], ptr @b, i64 0, i64 3, i64 %indvars.iv108.3
  store i32 %174, ptr %175, align 4, !tbaa !5
  br label %176

176:                                              ; preds = %176, %.lr.ph.3
  %indvars.iv.3 = phi i64 [ 1, %.lr.ph.3 ], [ %indvars.iv.next.3, %176 ]
  %177 = add nsw i64 %indvars.iv.3, -1
  %178 = getelementptr inbounds [7285 x i32], ptr @c, i64 0, i64 %177
  %179 = load i32, ptr %178, align 4, !tbaa !5
  %180 = load i32, ptr %3, align 4, !tbaa !5
  %181 = add nsw i32 %180, %179
  %.not64.3 = icmp slt i32 %181, %163
  %182 = select i1 %.not64.3, i32 0, i32 %163
  %spec.select.3 = sub nsw i32 %181, %182
  store i32 %spec.select.3, ptr %3, align 4, !tbaa !5
  %183 = getelementptr inbounds [7285 x i32], ptr @c, i64 0, i64 %indvars.iv.3
  call void @_ZSt4swapIiENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 4 dereferenceable(4) %183, ptr noundef nonnull align 4 dereferenceable(4) %3) #7
  %indvars.iv.next.3 = add nuw nsw i64 %indvars.iv.3, 1
  %exitcond.3.not = icmp eq i64 %indvars.iv.next.3, %indvars.iv106.3
  br i1 %exitcond.3.not, label %184, label %176, !llvm.loop !14

184:                                              ; preds = %176
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #7
  %indvars.iv.next109.3 = add nuw nsw i64 %indvars.iv108.3, 1
  %indvars.iv.next107.3 = add nuw nsw i64 %indvars.iv106.3, 1
  %exitcond114.3.not = icmp eq i64 %indvars.iv.next109.3, %wide.trip.count113.3
  br i1 %exitcond114.3.not, label %._crit_edge.3, label %.lr.ph.3, !llvm.loop !15

._crit_edge.3:                                    ; preds = %184, %._crit_edge.2
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #7
  %185 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull @m)
  store i32 1, ptr @ans, align 4, !tbaa !5
  %186 = load i64, ptr @n, align 8, !tbaa !16
  %187 = icmp sgt i64 %186, 0
  br i1 %187, label %.lr.ph81.us, label %.split.preheader

.lr.ph:                                           ; preds = %.lr.ph.preheader, %193
  %indvars.iv108 = phi i64 [ 1, %.lr.ph.preheader ], [ %indvars.iv.next109, %193 ]
  %indvars.iv106 = phi i64 [ 2, %.lr.ph.preheader ], [ %indvars.iv.next107, %193 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #7
  %188 = load i32, ptr @c, align 16, !tbaa !5
  store i32 %188, ptr %3, align 4, !tbaa !5
  %189 = add nsw i64 %indvars.iv108, -1
  %190 = getelementptr inbounds [7285 x i32], ptr @c, i64 0, i64 %189
  %191 = load i32, ptr %190, align 4, !tbaa !5
  store i32 %191, ptr @c, align 16, !tbaa !5
  %192 = getelementptr inbounds [4 x [7285 x i32]], ptr @b, i64 0, i64 0, i64 %indvars.iv108
  store i32 %191, ptr %192, align 4, !tbaa !5
  br label %194

193:                                              ; preds = %194
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #7
  %indvars.iv.next109 = add nuw nsw i64 %indvars.iv108, 1
  %indvars.iv.next107 = add nuw nsw i64 %indvars.iv106, 1
  %exitcond114.not = icmp eq i64 %indvars.iv.next109, %wide.trip.count113
  br i1 %exitcond114.not, label %._crit_edge, label %.lr.ph, !llvm.loop !15

194:                                              ; preds = %.lr.ph, %194
  %indvars.iv = phi i64 [ 1, %.lr.ph ], [ %indvars.iv.next, %194 ]
  %195 = add nsw i64 %indvars.iv, -1
  %196 = getelementptr inbounds [7285 x i32], ptr @c, i64 0, i64 %195
  %197 = load i32, ptr %196, align 4, !tbaa !5
  %198 = load i32, ptr %3, align 4, !tbaa !5
  %199 = add nsw i32 %198, %197
  %.not64 = icmp slt i32 %199, %4
  %200 = select i1 %.not64, i32 0, i32 %4
  %spec.select = sub nsw i32 %199, %200
  store i32 %spec.select, ptr %3, align 4, !tbaa !5
  %201 = getelementptr inbounds [7285 x i32], ptr @c, i64 0, i64 %indvars.iv
  call void @_ZSt4swapIiENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 4 dereferenceable(4) %201, ptr noundef nonnull align 4 dereferenceable(4) %3) #7
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %indvars.iv106
  br i1 %exitcond.not, label %193, label %194, !llvm.loop !14

.split90.us:                                      ; preds = %._crit_edge82.us, %.split.preheader
  %.us-phi.in = phi i64 [ %49, %.split.preheader ], [ %86, %._crit_edge82.us ]
  %.us-phi = trunc nsw i64 %.us-phi.in to i32
  store i32 %.us-phi, ptr @ex, align 4, !tbaa !5
  %202 = load i64, ptr @m, align 8, !tbaa !16
  %storemerge91 = srem i64 %202, 999999599
  %203 = icmp sgt i64 %.us-phi.in, 0
  br i1 %203, label %.lr.ph94, label %216

.lr.ph94:                                         ; preds = %.split90.us, %212
  %storemerge92 = phi i64 [ %storemerge, %212 ], [ %storemerge91, %.split90.us ]
  %204 = phi i32 [ %214, %212 ], [ %.us-phi, %.split90.us ]
  %205 = phi i32 [ %213, %212 ], [ 1, %.split90.us ]
  %206 = and i32 %204, 1
  %.not = icmp eq i32 %206, 0
  br i1 %.not, label %212, label %207

207:                                              ; preds = %.lr.ph94
  %208 = sext i32 %205 to i64
  %209 = mul nsw i64 %storemerge92, %208
  %210 = srem i64 %209, 999999599
  %211 = trunc nsw i64 %210 to i32
  store i32 %211, ptr @ans, align 4, !tbaa !5
  br label %212

212:                                              ; preds = %.lr.ph94, %207
  %213 = phi i32 [ %205, %.lr.ph94 ], [ %211, %207 ]
  %214 = lshr i32 %204, 1
  %215 = mul nsw i64 %storemerge92, %storemerge92
  %storemerge = urem i64 %215, 999999599
  %.not97 = icmp ult i32 %204, 2
  br i1 %.not97, label %._crit_edge95, label %.lr.ph94, !llvm.loop !18

._crit_edge95:                                    ; preds = %212
  store i32 %214, ptr @ex, align 4, !tbaa !5
  br label %216

216:                                              ; preds = %._crit_edge95, %.split90.us
  %217 = phi i32 [ %213, %._crit_edge95 ], [ 1, %.split90.us ]
  %storemerge.lcssa = phi i64 [ %storemerge, %._crit_edge95 ], [ %storemerge91, %.split90.us ]
  store i64 %storemerge.lcssa, ptr @m, align 8, !tbaa !16
  %218 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %217)
  ret i32 0
}

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZSt4swapIiENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #3

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

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

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

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #6

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

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

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


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