; LLVM IR from tangjz/acm-icpc :: 51nod (1221)

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

@Gcd = external dso_local global [53 x [53 x i32]], align 16
@tot = external dso_local global i32, align 4
@pL = external dso_local global [53 x i32], align 16
@pR = external dso_local global [53 x i32], align 16
@low = external dso_local global [53 x i64], align 16
@upp = external dso_local global [53 x i64], align 16
@pos = external dso_local global [107 x i64], align 16
@tp = external dso_local global [53 x i64], align 16
@sp = external dso_local global [107 x i64], align 16
@.str = external hidden unnamed_addr constant [17 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [4 x i8], align 1

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z5solveiixx(i32 noundef, i32 noundef, i64 noundef, i64 noundef) #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_Z5iRootxi(i64 noundef, i32 noundef) #2

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #3 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i64, align 8
  %4 = alloca i64, align 8
  %5 = alloca i64, align 8
  %6 = alloca i64, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %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 i32, align 4
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #7
  %18 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %6, ptr noundef %4, ptr noundef %3, ptr noundef %5)
  %19 = load i64, ptr %3, align 8, !tbaa !5
  %20 = sub nsw i64 %19, 1
  %21 = load i64, ptr %4, align 8, !tbaa !5
  %22 = add nsw i64 %21, %20
  store i64 %22, ptr %4, align 8, !tbaa !5
  %23 = load i64, ptr %5, align 8, !tbaa !5
  %24 = sub nsw i64 %23, 1
  %25 = load i64, ptr %6, align 8, !tbaa !5
  %26 = add nsw i64 %25, %24
  store i64 %26, ptr %6, align 8, !tbaa !5
  %27 = load i32, ptr @tot, align 4, !tbaa !9
  %28 = add nsw i32 %27, 1
  store i32 %28, ptr @tot, align 4, !tbaa !9
  %29 = sext i32 %27 to i64
  %30 = getelementptr inbounds [107 x i64], ptr @pos, i64 0, i64 %29
  store i64 1, ptr %30, align 8, !tbaa !5
  store i32 1, ptr %2, align 4, !tbaa !9
  br label %31

31:                                               ; preds = %67, %0
  %32 = load i32, ptr %2, align 4, !tbaa !9
  %33 = zext i32 %32 to i64
  %34 = shl i64 1, %33
  %35 = load i64, ptr %4, align 8, !tbaa !5
  %36 = icmp sle i64 %34, %35
  br i1 %36, label %37, label %70

37:                                               ; preds = %31
  %38 = load i64, ptr %3, align 8, !tbaa !5
  %39 = sub nsw i64 %38, 1
  %40 = load i32, ptr %2, align 4, !tbaa !9
  %41 = call noundef i64 @_Z5iRootxi(i64 noundef %39, i32 noundef %40)
  %42 = load i32, ptr %2, align 4, !tbaa !9
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds [53 x i64], ptr @low, i64 0, i64 %43
  store i64 %41, ptr %44, align 8, !tbaa !5
  %45 = load i32, ptr @tot, align 4, !tbaa !9
  %46 = add nsw i32 %45, 1
  store i32 %46, ptr @tot, align 4, !tbaa !9
  %47 = sext i32 %45 to i64
  %48 = getelementptr inbounds [107 x i64], ptr @pos, i64 0, i64 %47
  store i64 %41, ptr %48, align 8, !tbaa !5
  %49 = load i64, ptr %4, align 8, !tbaa !5
  %50 = load i32, ptr %2, align 4, !tbaa !9
  %51 = call noundef i64 @_Z5iRootxi(i64 noundef %49, i32 noundef %50)
  %52 = load i32, ptr %2, align 4, !tbaa !9
  %53 = sext i32 %52 to i64
  %54 = getelementptr inbounds [53 x i64], ptr @upp, i64 0, i64 %53
  store i64 %51, ptr %54, align 8, !tbaa !5
  %55 = load i32, ptr @tot, align 4, !tbaa !9
  %56 = add nsw i32 %55, 1
  store i32 %56, ptr @tot, align 4, !tbaa !9
  %57 = sext i32 %55 to i64
  %58 = getelementptr inbounds [107 x i64], ptr @pos, i64 0, i64 %57
  store i64 %51, ptr %58, align 8, !tbaa !5
  %59 = load i32, ptr %2, align 4, !tbaa !9
  %60 = load i32, ptr %2, align 4, !tbaa !9
  %61 = sext i32 %60 to i64
  %62 = getelementptr inbounds [53 x [53 x i32]], ptr @Gcd, i64 0, i64 %61
  %63 = getelementptr inbounds [53 x i32], ptr %62, i64 0, i64 0
  store i32 %59, ptr %63, align 4, !tbaa !9
  %64 = load i32, ptr %2, align 4, !tbaa !9
  %65 = sext i32 %64 to i64
  %66 = getelementptr inbounds [53 x i32], ptr @Gcd, i64 0, i64 %65
  store i32 %59, ptr %66, align 4, !tbaa !9
  br label %67

67:                                               ; preds = %37
  %68 = load i32, ptr %2, align 4, !tbaa !9
  %69 = add nsw i32 %68, 1
  store i32 %69, ptr %2, align 4, !tbaa !9
  br label %31, !llvm.loop !11

70:                                               ; preds = %31
  %71 = load i32, ptr @tot, align 4, !tbaa !9
  %72 = sext i32 %71 to i64
  %73 = getelementptr inbounds i64, ptr @pos, i64 %72
  call void @_ZSt4sortIPxEvT_S1_(ptr noundef @pos, ptr noundef %73)
  %74 = load i32, ptr @tot, align 4, !tbaa !9
  %75 = sext i32 %74 to i64
  %76 = getelementptr inbounds i64, ptr @pos, i64 %75
  %77 = call noundef ptr @_ZSt6uniqueIPxET_S1_S1_(ptr noundef @pos, ptr noundef %76)
  %78 = ptrtoint ptr %77 to i64
  %79 = sub i64 %78, ptrtoint (ptr @pos to i64)
  %80 = sdiv exact i64 %79, 8
  %81 = trunc i64 %80 to i32
  store i32 %81, ptr @tot, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #7
  store i32 1, ptr %7, align 4, !tbaa !9
  br label %82

82:                                               ; preds = %156, %70
  %83 = load i32, ptr %7, align 4, !tbaa !9
  %84 = load i32, ptr @tot, align 4, !tbaa !9
  %85 = icmp slt i32 %83, %84
  br i1 %85, label %87, label %86

86:                                               ; preds = %82
  store i32 5, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #7
  br label %159

87:                                               ; preds = %82
  %88 = load i32, ptr %7, align 4, !tbaa !9
  %89 = sext i32 %88 to i64
  %90 = getelementptr inbounds [53 x i32], ptr @pL, i64 0, i64 %89
  store i32 53, ptr %90, align 4, !tbaa !9
  %91 = load i32, ptr %7, align 4, !tbaa !9
  %92 = sext i32 %91 to i64
  %93 = getelementptr inbounds [53 x i32], ptr @pR, i64 0, i64 %92
  store i32 0, ptr %93, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #7
  store i32 1, ptr %9, align 4, !tbaa !9
  br label %94

94:                                               ; preds = %114, %87
  %95 = load i32, ptr %9, align 4, !tbaa !9
  %96 = zext i32 %95 to i64
  %97 = shl i64 1, %96
  %98 = load i32, ptr %7, align 4, !tbaa !9
  %99 = sext i32 %98 to i64
  %100 = getelementptr inbounds [107 x i64], ptr @pos, i64 0, i64 %99
  %101 = load i64, ptr %100, align 8, !tbaa !5
  %102 = icmp sle i64 %97, %101
  br i1 %102, label %103, label %117

103:                                              ; preds = %94
  %104 = load i32, ptr %7, align 4, !tbaa !9
  %105 = sext i32 %104 to i64
  %106 = getelementptr inbounds [107 x i64], ptr @pos, i64 0, i64 %105
  %107 = load i64, ptr %106, align 8, !tbaa !5
  %108 = load i32, ptr %9, align 4, !tbaa !9
  %109 = call noundef i64 @_Z5iRootxi(i64 noundef %107, i32 noundef %108)
  %110 = sub nsw i64 %109, 1
  %111 = load i32, ptr %9, align 4, !tbaa !9
  %112 = sext i32 %111 to i64
  %113 = getelementptr inbounds [53 x i64], ptr @tp, i64 0, i64 %112
  store i64 %110, ptr %113, align 8, !tbaa !5
  br label %114

114:                                              ; preds = %103
  %115 = load i32, ptr %9, align 4, !tbaa !9
  %116 = add nsw i32 %115, 1
  store i32 %116, ptr %9, align 4, !tbaa !9
  br label %94, !llvm.loop !13

117:                                              ; preds = %94
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #7
  %118 = load i32, ptr %9, align 4, !tbaa !9
  %119 = sub nsw i32 %118, 1
  store i32 %119, ptr %10, align 4, !tbaa !9
  br label %120

120:                                              ; preds = %148, %117
  %121 = load i32, ptr %10, align 4, !tbaa !9
  %122 = icmp sge i32 %121, 1
  br i1 %122, label %124, label %123

123:                                              ; preds = %120
  store i32 11, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #7
  br label %151

124:                                              ; preds = %120
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #7
  %125 = load i32, ptr %10, align 4, !tbaa !9
  %126 = load i32, ptr %10, align 4, !tbaa !9
  %127 = add nsw i32 %125, %126
  store i32 %127, ptr %11, align 4, !tbaa !9
  br label %128

128:                                              ; preds = %143, %124
  %129 = load i32, ptr %11, align 4, !tbaa !9
  %130 = load i32, ptr %9, align 4, !tbaa !9
  %131 = icmp slt i32 %129, %130
  br i1 %131, label %133, label %132

132:                                              ; preds = %128
  store i32 14, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #7
  br label %147

133:                                              ; preds = %128
  %134 = load i32, ptr %11, align 4, !tbaa !9
  %135 = sext i32 %134 to i64
  %136 = getelementptr inbounds [53 x i64], ptr @tp, i64 0, i64 %135
  %137 = load i64, ptr %136, align 8, !tbaa !5
  %138 = load i32, ptr %10, align 4, !tbaa !9
  %139 = sext i32 %138 to i64
  %140 = getelementptr inbounds [53 x i64], ptr @tp, i64 0, i64 %139
  %141 = load i64, ptr %140, align 8, !tbaa !5
  %142 = sub nsw i64 %141, %137
  store i64 %142, ptr %140, align 8, !tbaa !5
  br label %143

143:                                              ; preds = %133
  %144 = load i32, ptr %10, align 4, !tbaa !9
  %145 = load i32, ptr %11, align 4, !tbaa !9
  %146 = add nsw i32 %145, %144
  store i32 %146, ptr %11, align 4, !tbaa !9
  br label %128, !llvm.loop !14

147:                                              ; preds = %132
  br label %148

148:                                              ; preds = %147
  %149 = load i32, ptr %10, align 4, !tbaa !9
  %150 = add nsw i32 %149, -1
  store i32 %150, ptr %10, align 4, !tbaa !9
  br label %120, !llvm.loop !15

151:                                              ; preds = %123
  %152 = load i64, ptr getelementptr inbounds ([53 x i64], ptr @tp, i64 0, i64 1), align 8, !tbaa !5
  %153 = load i32, ptr %7, align 4, !tbaa !9
  %154 = sext i32 %153 to i64
  %155 = getelementptr inbounds [107 x i64], ptr @sp, i64 0, i64 %154
  store i64 %152, ptr %155, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #7
  br label %156

156:                                              ; preds = %151
  %157 = load i32, ptr %7, align 4, !tbaa !9
  %158 = add nsw i32 %157, 1
  store i32 %158, ptr %7, align 4, !tbaa !9
  br label %82, !llvm.loop !16

159:                                              ; preds = %86
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #7
  store i32 1, ptr %12, align 4, !tbaa !9
  br label %160

160:                                              ; preds = %247, %159
  %161 = load i32, ptr %12, align 4, !tbaa !9
  %162 = load i32, ptr %2, align 4, !tbaa !9
  %163 = icmp slt i32 %161, %162
  br i1 %163, label %165, label %164

164:                                              ; preds = %160
  store i32 17, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #7
  br label %250

165:                                              ; preds = %160
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #7
  %166 = load i32, ptr @tot, align 4, !tbaa !9
  %167 = sext i32 %166 to i64
  %168 = getelementptr inbounds i64, ptr @pos, i64 %167
  %169 = load i32, ptr %12, align 4, !tbaa !9
  %170 = sext i32 %169 to i64
  %171 = getelementptr inbounds [53 x i64], ptr @low, i64 0, i64 %170
  %172 = call noundef ptr @_ZSt11lower_boundIPxxET_S1_S1_RKT0_(ptr noundef @pos, ptr noundef %168, ptr noundef nonnull align 8 dereferenceable(8) %171)
  %173 = ptrtoint ptr %172 to i64
  %174 = sub i64 %173, ptrtoint (ptr @pos to i64)
  %175 = sdiv exact i64 %174, 8
  %176 = add nsw i64 %175, 1
  %177 = trunc i64 %176 to i32
  store i32 %177, ptr %13, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #7
  %178 = load i32, ptr @tot, align 4, !tbaa !9
  %179 = sext i32 %178 to i64
  %180 = getelementptr inbounds i64, ptr @pos, i64 %179
  %181 = load i32, ptr %12, align 4, !tbaa !9
  %182 = sext i32 %181 to i64
  %183 = getelementptr inbounds [53 x i64], ptr @upp, i64 0, i64 %182
  %184 = call noundef ptr @_ZSt11lower_boundIPxxET_S1_S1_RKT0_(ptr noundef @pos, ptr noundef %180, ptr noundef nonnull align 8 dereferenceable(8) %183)
  %185 = ptrtoint ptr %184 to i64
  %186 = sub i64 %185, ptrtoint (ptr @pos to i64)
  %187 = sdiv exact i64 %186, 8
  %188 = add nsw i64 %187, 1
  %189 = trunc i64 %188 to i32
  store i32 %189, ptr %14, align 4, !tbaa !9
  br label %190

190:                                              ; preds = %211, %165
  %191 = load i32, ptr %13, align 4, !tbaa !9
  %192 = load i32, ptr %14, align 4, !tbaa !9
  %193 = icmp slt i32 %191, %192
  br i1 %193, label %194, label %214

194:                                              ; preds = %190
  %195 = load i32, ptr %13, align 4, !tbaa !9
  %196 = sext i32 %195 to i64
  %197 = getelementptr inbounds [53 x i32], ptr @pL, i64 0, i64 %196
  %198 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %197, ptr noundef nonnull align 4 dereferenceable(4) %12)
  %199 = load i32, ptr %198, align 4, !tbaa !9
  %200 = load i32, ptr %13, align 4, !tbaa !9
  %201 = sext i32 %200 to i64
  %202 = getelementptr inbounds [53 x i32], ptr @pL, i64 0, i64 %201
  store i32 %199, ptr %202, align 4, !tbaa !9
  %203 = load i32, ptr %13, align 4, !tbaa !9
  %204 = sext i32 %203 to i64
  %205 = getelementptr inbounds [53 x i32], ptr @pR, i64 0, i64 %204
  %206 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %205, ptr noundef nonnull align 4 dereferenceable(4) %12)
  %207 = load i32, ptr %206, align 4, !tbaa !9
  %208 = load i32, ptr %13, align 4, !tbaa !9
  %209 = sext i32 %208 to i64
  %210 = getelementptr inbounds [53 x i32], ptr @pR, i64 0, i64 %209
  store i32 %207, ptr %210, align 4, !tbaa !9
  br label %211

211:                                              ; preds = %194
  %212 = load i32, ptr %13, align 4, !tbaa !9
  %213 = add nsw i32 %212, 1
  store i32 %213, ptr %13, align 4, !tbaa !9
  br label %190, !llvm.loop !17

214:                                              ; preds = %190
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #7
  %215 = load i32, ptr %12, align 4, !tbaa !9
  store i32 %215, ptr %15, align 4, !tbaa !9
  br label %216

216:                                              ; preds = %243, %214
  %217 = load i32, ptr %15, align 4, !tbaa !9
  %218 = load i32, ptr %2, align 4, !tbaa !9
  %219 = icmp slt i32 %217, %218
  br i1 %219, label %221, label %220

220:                                              ; preds = %216
  store i32 23, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #7
  br label %246

221:                                              ; preds = %216
  %222 = load i32, ptr %12, align 4, !tbaa !9
  %223 = sext i32 %222 to i64
  %224 = getelementptr inbounds [53 x [53 x i32]], ptr @Gcd, i64 0, i64 %223
  %225 = load i32, ptr %15, align 4, !tbaa !9
  %226 = load i32, ptr %12, align 4, !tbaa !9
  %227 = sub nsw i32 %225, %226
  %228 = sext i32 %227 to i64
  %229 = getelementptr inbounds [53 x i32], ptr %224, i64 0, i64 %228
  %230 = load i32, ptr %229, align 4, !tbaa !9
  %231 = load i32, ptr %15, align 4, !tbaa !9
  %232 = sext i32 %231 to i64
  %233 = getelementptr inbounds [53 x [53 x i32]], ptr @Gcd, i64 0, i64 %232
  %234 = load i32, ptr %12, align 4, !tbaa !9
  %235 = sext i32 %234 to i64
  %236 = getelementptr inbounds [53 x i32], ptr %233, i64 0, i64 %235
  store i32 %230, ptr %236, align 4, !tbaa !9
  %237 = load i32, ptr %12, align 4, !tbaa !9
  %238 = sext i32 %237 to i64
  %239 = getelementptr inbounds [53 x [53 x i32]], ptr @Gcd, i64 0, i64 %238
  %240 = load i32, ptr %15, align 4, !tbaa !9
  %241 = sext i32 %240 to i64
  %242 = getelementptr inbounds [53 x i32], ptr %239, i64 0, i64 %241
  store i32 %230, ptr %242, align 4, !tbaa !9
  br label %243

243:                                              ; preds = %221
  %244 = load i32, ptr %15, align 4, !tbaa !9
  %245 = add nsw i32 %244, 1
  store i32 %245, ptr %15, align 4, !tbaa !9
  br label %216, !llvm.loop !18

246:                                              ; preds = %220
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #7
  br label %247

247:                                              ; preds = %246
  %248 = load i32, ptr %12, align 4, !tbaa !9
  %249 = add nsw i32 %248, 1
  store i32 %249, ptr %12, align 4, !tbaa !9
  br label %160, !llvm.loop !19

250:                                              ; preds = %164
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #7
  store i32 0, ptr %16, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #7
  store i32 1, ptr %17, align 4, !tbaa !9
  br label %251

251:                                              ; preds = %297, %250
  %252 = load i32, ptr %17, align 4, !tbaa !9
  %253 = load i32, ptr @tot, align 4, !tbaa !9
  %254 = icmp slt i32 %252, %253
  br i1 %254, label %256, label %255

255:                                              ; preds = %251
  store i32 26, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #7
  br label %300

256:                                              ; preds = %251
  %257 = load i32, ptr %17, align 4, !tbaa !9
  %258 = sext i32 %257 to i64
  %259 = getelementptr inbounds [53 x i32], ptr @pL, i64 0, i64 %258
  %260 = load i32, ptr %259, align 4, !tbaa !9
  %261 = load i32, ptr %17, align 4, !tbaa !9
  %262 = sext i32 %261 to i64
  %263 = getelementptr inbounds [53 x i32], ptr @pR, i64 0, i64 %262
  %264 = load i32, ptr %263, align 4, !tbaa !9
  %265 = icmp sle i32 %260, %264
  br i1 %265, label %266, label %296

266:                                              ; preds = %256
  %267 = load i32, ptr %16, align 4, !tbaa !9
  %268 = sext i32 %267 to i64
  %269 = load i32, ptr %17, align 4, !tbaa !9
  %270 = sext i32 %269 to i64
  %271 = getelementptr inbounds [107 x i64], ptr @sp, i64 0, i64 %270
  %272 = load i64, ptr %271, align 8, !tbaa !5
  %273 = load i32, ptr %17, align 4, !tbaa !9
  %274 = sub nsw i32 %273, 1
  %275 = sext i32 %274 to i64
  %276 = getelementptr inbounds [107 x i64], ptr @sp, i64 0, i64 %275
  %277 = load i64, ptr %276, align 8, !tbaa !5
  %278 = sub nsw i64 %272, %277
  %279 = srem i64 %278, 1000000007
  %280 = load i32, ptr %17, align 4, !tbaa !9
  %281 = sext i32 %280 to i64
  %282 = getelementptr inbounds [53 x i32], ptr @pL, i64 0, i64 %281
  %283 = load i32, ptr %282, align 4, !tbaa !9
  %284 = load i32, ptr %17, align 4, !tbaa !9
  %285 = sext i32 %284 to i64
  %286 = getelementptr inbounds [53 x i32], ptr @pR, i64 0, i64 %285
  %287 = load i32, ptr %286, align 4, !tbaa !9
  %288 = load i64, ptr %5, align 8, !tbaa !5
  %289 = load i64, ptr %6, align 8, !tbaa !5
  %290 = call noundef i32 @_Z5solveiixx(i32 noundef %283, i32 noundef %287, i64 noundef %288, i64 noundef %289)
  %291 = sext i32 %290 to i64
  %292 = mul nsw i64 %279, %291
  %293 = add nsw i64 %268, %292
  %294 = srem i64 %293, 1000000007
  %295 = trunc i64 %294 to i32
  store i32 %295, ptr %16, align 4, !tbaa !9
  br label %296

296:                                              ; preds = %266, %256
  br label %297

297:                                              ; preds = %296
  %298 = load i32, ptr %17, align 4, !tbaa !9
  %299 = add nsw i32 %298, 1
  store i32 %299, ptr %17, align 4, !tbaa !9
  br label %251, !llvm.loop !20

300:                                              ; preds = %255
  %301 = load i32, ptr %16, align 4, !tbaa !9
  %302 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, i32 noundef %301)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #7
  %303 = load i32, ptr %1, align 4
  ret i32 %303
}

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

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

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

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

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

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

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

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

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

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


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

@Gcd = external dso_local local_unnamed_addr global [53 x [53 x i32]], align 16
@tot = external dso_local local_unnamed_addr global i32, align 4
@pL = external dso_local global [53 x i32], align 16
@pR = external dso_local global [53 x i32], align 16
@low = external dso_local global [53 x i64], align 16
@upp = external dso_local global [53 x i64], align 16
@pos = external dso_local global [107 x i64], align 16
@tp = external dso_local local_unnamed_addr global [53 x i64], align 16
@sp = external dso_local local_unnamed_addr global [107 x i64], align 16
@.str = external hidden unnamed_addr constant [17 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [4 x i8], align 1

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_Z5iRootxi(i64 noundef, i32 noundef) local_unnamed_addr #2

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #3 {
  %1 = alloca i64, align 8
  %2 = alloca i64, align 8
  %3 = alloca i64, align 8
  %4 = alloca i64, align 8
  %5 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #7
  %6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %4, ptr noundef nonnull %2, ptr noundef nonnull %1, ptr noundef nonnull %3)
  %7 = load i64, ptr %1, align 8, !tbaa !5
  %8 = add nsw i64 %7, -1
  %9 = load i64, ptr %2, align 8, !tbaa !5
  %10 = add nsw i64 %8, %9
  store i64 %10, ptr %2, align 8, !tbaa !5
  %11 = load i64, ptr %3, align 8, !tbaa !5
  %12 = add nsw i64 %11, -1
  %13 = load i64, ptr %4, align 8, !tbaa !5
  %14 = add nsw i64 %12, %13
  store i64 %14, ptr %4, align 8, !tbaa !5
  %15 = load i32, ptr @tot, align 4, !tbaa !9
  %16 = add nsw i32 %15, 1
  store i32 %16, ptr @tot, align 4, !tbaa !9
  %17 = sext i32 %15 to i64
  %18 = getelementptr inbounds [107 x i64], ptr @pos, i64 0, i64 %17
  store i64 1, ptr %18, align 8, !tbaa !5
  %.not70 = icmp slt i64 %10, 2
  br i1 %.not70, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 1, %0 ]
  %19 = load i64, ptr %1, align 8, !tbaa !5
  %20 = add nsw i64 %19, -1
  %21 = trunc nuw nsw i64 %indvars.iv to i32
  %22 = call noundef i64 @_Z5iRootxi(i64 noundef %20, i32 noundef %21)
  %23 = getelementptr inbounds [53 x i64], ptr @low, i64 0, i64 %indvars.iv
  store i64 %22, ptr %23, align 8, !tbaa !5
  %24 = load i32, ptr @tot, align 4, !tbaa !9
  %25 = add nsw i32 %24, 1
  store i32 %25, ptr @tot, align 4, !tbaa !9
  %26 = sext i32 %24 to i64
  %27 = getelementptr inbounds [107 x i64], ptr @pos, i64 0, i64 %26
  store i64 %22, ptr %27, align 8, !tbaa !5
  %28 = load i64, ptr %2, align 8, !tbaa !5
  %29 = call noundef i64 @_Z5iRootxi(i64 noundef %28, i32 noundef %21)
  %30 = getelementptr inbounds [53 x i64], ptr @upp, i64 0, i64 %indvars.iv
  store i64 %29, ptr %30, align 8, !tbaa !5
  %31 = load i32, ptr @tot, align 4, !tbaa !9
  %32 = add nsw i32 %31, 1
  store i32 %32, ptr @tot, align 4, !tbaa !9
  %33 = sext i32 %31 to i64
  %34 = getelementptr inbounds [107 x i64], ptr @pos, i64 0, i64 %33
  store i64 %29, ptr %34, align 8, !tbaa !5
  %35 = getelementptr inbounds [53 x [53 x i32]], ptr @Gcd, i64 0, i64 %indvars.iv
  store i32 %21, ptr %35, align 4, !tbaa !9
  %36 = getelementptr inbounds [53 x i32], ptr @Gcd, i64 0, i64 %indvars.iv
  store i32 %21, ptr %36, align 4, !tbaa !9
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %37 = shl nuw i64 2, %indvars.iv
  %38 = load i64, ptr %2, align 8, !tbaa !5
  %.not = icmp sgt i64 %37, %38
  br i1 %.not, label %._crit_edge.loopexit, label %.lr.ph, !llvm.loop !11

._crit_edge.loopexit:                             ; preds = %.lr.ph
  %39 = trunc nuw i64 %indvars.iv.next to i32
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %0
  %40 = phi i32 [ %16, %0 ], [ %32, %._crit_edge.loopexit ]
  %.063.lcssa = phi i32 [ 1, %0 ], [ %39, %._crit_edge.loopexit ]
  %41 = sext i32 %40 to i64
  %42 = getelementptr inbounds i64, ptr @pos, i64 %41
  call void @_ZSt4sortIPxEvT_S1_(ptr noundef nonnull @pos, ptr noundef nonnull %42)
  %43 = load i32, ptr @tot, align 4, !tbaa !9
  %44 = sext i32 %43 to i64
  %45 = getelementptr inbounds i64, ptr @pos, i64 %44
  %46 = call noundef ptr @_ZSt6uniqueIPxET_S1_S1_(ptr noundef nonnull @pos, ptr noundef nonnull %45)
  %47 = ptrtoint ptr %46 to i64
  %48 = sub i64 %47, ptrtoint (ptr @pos to i64)
  %49 = lshr exact i64 %48, 3
  %50 = trunc i64 %49 to i32
  store i32 %50, ptr @tot, align 4, !tbaa !9
  %51 = icmp sgt i32 %50, 1
  br i1 %51, label %.lr.ph86, label %._crit_edge87

._crit_edge87:                                    ; preds = %._crit_edge83, %._crit_edge
  %52 = phi i32 [ %50, %._crit_edge ], [ %75, %._crit_edge83 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #7
  store i32 1, ptr %5, align 4, !tbaa !9
  %53 = icmp sgt i32 %.063.lcssa, 1
  br i1 %53, label %.lr.ph99.preheader, label %._crit_edge100

.lr.ph99.preheader:                               ; preds = %._crit_edge87
  %wide.trip.count = zext nneg i32 %.063.lcssa to i64
  %54 = add nsw i64 %wide.trip.count, -1
  br label %.lr.ph99

.lr.ph86:                                         ; preds = %._crit_edge, %._crit_edge83
  %indvars.iv122 = phi i64 [ %indvars.iv.next123, %._crit_edge83 ], [ 1, %._crit_edge ]
  %55 = getelementptr inbounds [53 x i32], ptr @pL, i64 0, i64 %indvars.iv122
  store i32 53, ptr %55, align 4, !tbaa !9
  %56 = getelementptr inbounds [53 x i32], ptr @pR, i64 0, i64 %indvars.iv122
  store i32 0, ptr %56, align 4, !tbaa !9
  %57 = getelementptr inbounds [107 x i64], ptr @pos, i64 0, i64 %indvars.iv122
  %58 = load i64, ptr %57, align 8, !tbaa !5
  %.not6972 = icmp slt i64 %58, 2
  br i1 %.not6972, label %._crit_edge83, label %.lr.ph75

.preheader:                                       ; preds = %.lr.ph75
  %59 = trunc nuw i64 %indvars.iv.next110 to i32
  %60 = icmp sgt i32 %59, 1
  br i1 %60, label %.lr.ph82.preheader, label %._crit_edge83

.lr.ph82.preheader:                               ; preds = %.preheader
  %61 = shl nuw i32 %59, 1
  %62 = and i64 %indvars.iv109, 4294967295
  %63 = and i64 %indvars.iv.next110, 2147483647
  %64 = and i64 %indvars.iv.next110, 2147483647
  br label %.lr.ph82

.lr.ph75:                                         ; preds = %.lr.ph86, %.lr.ph75
  %indvars.iv109 = phi i64 [ %indvars.iv.next110, %.lr.ph75 ], [ 1, %.lr.ph86 ]
  %65 = phi i64 [ %71, %.lr.ph75 ], [ %58, %.lr.ph86 ]
  %66 = trunc nuw nsw i64 %indvars.iv109 to i32
  %67 = call noundef i64 @_Z5iRootxi(i64 noundef %65, i32 noundef %66)
  %68 = add nsw i64 %67, -1
  %69 = getelementptr inbounds [53 x i64], ptr @tp, i64 0, i64 %indvars.iv109
  store i64 %68, ptr %69, align 8, !tbaa !5
  %indvars.iv.next110 = add nuw nsw i64 %indvars.iv109, 1
  %70 = shl nuw i64 2, %indvars.iv109
  %71 = load i64, ptr %57, align 8, !tbaa !5
  %.not69 = icmp sgt i64 %70, %71
  br i1 %.not69, label %.preheader, label %.lr.ph75, !llvm.loop !13

.loopexit:                                        ; preds = %82, %.lr.ph82
  %72 = icmp sgt i64 %indvars.iv119, 2
  %indvars.iv.next115 = add nsw i64 %indvars.iv114, -1
  br i1 %72, label %.lr.ph82, label %._crit_edge83, !llvm.loop !14

._crit_edge83:                                    ; preds = %.loopexit, %.lr.ph86, %.preheader
  %73 = load i64, ptr getelementptr inbounds (i8, ptr @tp, i64 8), align 8, !tbaa !5
  %74 = getelementptr inbounds [107 x i64], ptr @sp, i64 0, i64 %indvars.iv122
  store i64 %73, ptr %74, align 8, !tbaa !5
  %indvars.iv.next123 = add nuw nsw i64 %indvars.iv122, 1
  %75 = load i32, ptr @tot, align 4, !tbaa !9
  %76 = sext i32 %75 to i64
  %77 = icmp slt i64 %indvars.iv.next123, %76
  br i1 %77, label %.lr.ph86, label %._crit_edge87, !llvm.loop !15

.lr.ph82:                                         ; preds = %.lr.ph82.preheader, %.loopexit
  %indvars.iv119 = phi i64 [ %63, %.lr.ph82.preheader ], [ %indvars.iv.next120, %.loopexit ]
  %indvars.iv114 = phi i64 [ %62, %.lr.ph82.preheader ], [ %indvars.iv.next115, %.loopexit ]
  %indvars.iv112.in = phi i32 [ %61, %.lr.ph82.preheader ], [ %indvars.iv112, %.loopexit ]
  %indvars.iv112 = add i32 %indvars.iv112.in, -2
  %indvars.iv.next120 = add nsw i64 %indvars.iv119, -1
  %78 = shl nuw nsw i64 %indvars.iv.next120, 1
  %79 = icmp ult i64 %78, %64
  br i1 %79, label %.lr.ph79, label %.loopexit

.lr.ph79:                                         ; preds = %.lr.ph82
  %80 = zext i32 %indvars.iv112 to i64
  %81 = getelementptr inbounds [53 x i64], ptr @tp, i64 0, i64 %indvars.iv.next120
  %.promoted = load i64, ptr %81, align 8, !tbaa !5
  br label %82

82:                                               ; preds = %.lr.ph79, %82
  %indvars.iv116 = phi i64 [ %80, %.lr.ph79 ], [ %indvars.iv.next117, %82 ]
  %83 = phi i64 [ %.promoted, %.lr.ph79 ], [ %86, %82 ]
  %84 = getelementptr inbounds [53 x i64], ptr @tp, i64 0, i64 %indvars.iv116
  %85 = load i64, ptr %84, align 8, !tbaa !5
  %86 = sub nsw i64 %83, %85
  store i64 %86, ptr %81, align 8, !tbaa !5
  %indvars.iv.next117 = add nuw nsw i64 %indvars.iv116, %indvars.iv114
  %87 = trunc nuw i64 %indvars.iv.next117 to i32
  %88 = icmp sgt i32 %59, %87
  br i1 %88, label %82, label %.loopexit, !llvm.loop !16

._crit_edge100.loopexit:                          ; preds = %._crit_edge96
  %.pre = load i32, ptr @tot, align 4, !tbaa !9
  br label %._crit_edge100

._crit_edge100:                                   ; preds = %._crit_edge100.loopexit, %._crit_edge87
  %89 = phi i32 [ %.pre, %._crit_edge100.loopexit ], [ %52, %._crit_edge87 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #7
  %90 = icmp sgt i32 %89, 1
  br i1 %90, label %.lr.ph104, label %._crit_edge105

.lr.ph99:                                         ; preds = %.lr.ph99.preheader, %._crit_edge96
  %storemerge97 = phi i32 [ %129, %._crit_edge96 ], [ 1, %.lr.ph99.preheader ]
  %91 = load i32, ptr @tot, align 4, !tbaa !9
  %92 = sext i32 %91 to i64
  %93 = getelementptr inbounds i64, ptr @pos, i64 %92
  %94 = sext i32 %storemerge97 to i64
  %95 = getelementptr inbounds [53 x i64], ptr @low, i64 0, i64 %94
  %96 = call noundef ptr @_ZSt11lower_boundIPxxET_S1_S1_RKT0_(ptr noundef nonnull @pos, ptr noundef nonnull %93, ptr noundef nonnull align 8 dereferenceable(8) %95)
  %97 = ptrtoint ptr %96 to i64
  %98 = sub i64 %97, ptrtoint (ptr @pos to i64)
  %99 = lshr exact i64 %98, 3
  %100 = trunc i64 %99 to i32
  %101 = load i32, ptr @tot, align 4, !tbaa !9
  %102 = sext i32 %101 to i64
  %103 = getelementptr inbounds i64, ptr @pos, i64 %102
  %104 = load i32, ptr %5, align 4, !tbaa !9
  %105 = sext i32 %104 to i64
  %106 = getelementptr inbounds [53 x i64], ptr @upp, i64 0, i64 %105
  %107 = call noundef ptr @_ZSt11lower_boundIPxxET_S1_S1_RKT0_(ptr noundef nonnull @pos, ptr noundef nonnull %103, ptr noundef nonnull align 8 dereferenceable(8) %106)
  %108 = ptrtoint ptr %107 to i64
  %109 = sub i64 %108, ptrtoint (ptr @pos to i64)
  %110 = lshr exact i64 %109, 3
  %111 = trunc i64 %110 to i32
  %112 = add i32 %111, 1
  %.05888 = add i32 %100, 1
  %113 = icmp slt i32 %.05888, %112
  br i1 %113, label %.lr.ph91.preheader, label %._crit_edge92

.lr.ph91.preheader:                               ; preds = %.lr.ph99
  %114 = sext i32 %.05888 to i64
  br label %.lr.ph91

.lr.ph91:                                         ; preds = %.lr.ph91.preheader, %.lr.ph91
  %indvars.iv125 = phi i64 [ %114, %.lr.ph91.preheader ], [ %indvars.iv.next126, %.lr.ph91 ]
  %115 = getelementptr inbounds [53 x i32], ptr @pL, i64 0, i64 %indvars.iv125
  %116 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %115, ptr noundef nonnull align 4 dereferenceable(4) %5)
  %117 = load i32, ptr %116, align 4, !tbaa !9
  store i32 %117, ptr %115, align 4, !tbaa !9
  %118 = getelementptr inbounds [53 x i32], ptr @pR, i64 0, i64 %indvars.iv125
  %119 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %118, ptr noundef nonnull align 4 dereferenceable(4) %5)
  %120 = load i32, ptr %119, align 4, !tbaa !9
  store i32 %120, ptr %118, align 4, !tbaa !9
  %indvars.iv.next126 = add nsw i64 %indvars.iv125, 1
  %lftr.wideiv = trunc i64 %indvars.iv.next126 to i32
  %exitcond.not = icmp eq i32 %112, %lftr.wideiv
  br i1 %exitcond.not, label %._crit_edge92, label %.lr.ph91, !llvm.loop !17

._crit_edge92:                                    ; preds = %.lr.ph91, %.lr.ph99
  %121 = load i32, ptr %5, align 4, !tbaa !9
  %122 = icmp slt i32 %121, %.063.lcssa
  br i1 %122, label %.lr.ph95, label %._crit_edge96

.lr.ph95:                                         ; preds = %._crit_edge92
  %123 = sext i32 %121 to i64
  %124 = sub nsw i64 %wide.trip.count, %123
  %xtraiter = and i64 %124, 1
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.prol.loopexit, label %.prol.loopexit.unr-lcssa

.prol.loopexit.unr-lcssa:                         ; preds = %.lr.ph95
  %125 = getelementptr inbounds [53 x [53 x i32]], ptr @Gcd, i64 0, i64 %123, i64 0
  %126 = load i32, ptr %125, align 4, !tbaa !9
  %127 = getelementptr inbounds [53 x [53 x i32]], ptr @Gcd, i64 0, i64 %123, i64 %123
  store i32 %126, ptr %127, align 4, !tbaa !9
  %indvars.iv.next129.prol = add nsw i64 %123, 1
  br label %.prol.loopexit

.prol.loopexit:                                   ; preds = %.prol.loopexit.unr-lcssa, %.lr.ph95
  %indvars.iv128.unr = phi i64 [ %123, %.lr.ph95 ], [ %indvars.iv.next129.prol, %.prol.loopexit.unr-lcssa ]
  %128 = icmp eq i64 %54, %123
  br i1 %128, label %._crit_edge96, label %.lr.ph95.new

._crit_edge96:                                    ; preds = %.prol.loopexit, %.lr.ph95.new, %._crit_edge92
  %129 = add nsw i32 %121, 1
  store i32 %129, ptr %5, align 4, !tbaa !9
  %130 = icmp slt i32 %129, %.063.lcssa
  br i1 %130, label %.lr.ph99, label %._crit_edge100.loopexit, !llvm.loop !18

.lr.ph95.new:                                     ; preds = %.prol.loopexit, %.lr.ph95.new
  %indvars.iv128 = phi i64 [ %indvars.iv.next129.1, %.lr.ph95.new ], [ %indvars.iv128.unr, %.prol.loopexit ]
  %131 = sub nsw i64 %indvars.iv128, %123
  %132 = getelementptr inbounds [53 x [53 x i32]], ptr @Gcd, i64 0, i64 %123, i64 %131
  %133 = load i32, ptr %132, align 4, !tbaa !9
  %134 = getelementptr inbounds [53 x [53 x i32]], ptr @Gcd, i64 0, i64 %indvars.iv128, i64 %123
  store i32 %133, ptr %134, align 4, !tbaa !9
  %135 = getelementptr inbounds [53 x [53 x i32]], ptr @Gcd, i64 0, i64 %123, i64 %indvars.iv128
  store i32 %133, ptr %135, align 4, !tbaa !9
  %indvars.iv.next129 = add nsw i64 %indvars.iv128, 1
  %136 = sub nsw i64 %indvars.iv.next129, %123
  %137 = getelementptr inbounds [53 x [53 x i32]], ptr @Gcd, i64 0, i64 %123, i64 %136
  %138 = load i32, ptr %137, align 4, !tbaa !9
  %139 = getelementptr inbounds [53 x [53 x i32]], ptr @Gcd, i64 0, i64 %indvars.iv.next129, i64 %123
  store i32 %138, ptr %139, align 4, !tbaa !9
  %140 = getelementptr inbounds [53 x [53 x i32]], ptr @Gcd, i64 0, i64 %123, i64 %indvars.iv.next129
  store i32 %138, ptr %140, align 4, !tbaa !9
  %indvars.iv.next129.1 = add nsw i64 %indvars.iv128, 2
  %exitcond131.not.1 = icmp eq i64 %indvars.iv.next129.1, %wide.trip.count
  br i1 %exitcond131.not.1, label %._crit_edge96, label %.lr.ph95.new, !llvm.loop !19

._crit_edge105:                                   ; preds = %164, %._crit_edge100
  %.056.lcssa = phi i32 [ 0, %._crit_edge100 ], [ %.1, %164 ]
  %141 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %.056.lcssa)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #7
  ret i32 0

.lr.ph104:                                        ; preds = %._crit_edge100, %164
  %142 = phi i32 [ %165, %164 ], [ %89, %._crit_edge100 ]
  %indvars.iv132 = phi i64 [ %indvars.iv.next133, %164 ], [ 1, %._crit_edge100 ]
  %.056101 = phi i32 [ %.1, %164 ], [ 0, %._crit_edge100 ]
  %143 = getelementptr inbounds [53 x i32], ptr @pL, i64 0, i64 %indvars.iv132
  %144 = load i32, ptr %143, align 4, !tbaa !9
  %145 = getelementptr inbounds [53 x i32], ptr @pR, i64 0, i64 %indvars.iv132
  %146 = load i32, ptr %145, align 4, !tbaa !9
  %.not68 = icmp sgt i32 %144, %146
  br i1 %.not68, label %164, label %147

147:                                              ; preds = %.lr.ph104
  %148 = sext i32 %.056101 to i64
  %149 = getelementptr inbounds [107 x i64], ptr @sp, i64 0, i64 %indvars.iv132
  %150 = load i64, ptr %149, align 8, !tbaa !5
  %151 = add nsw i64 %indvars.iv132, -1
  %152 = getelementptr inbounds [107 x i64], ptr @sp, i64 0, i64 %151
  %153 = load i64, ptr %152, align 8, !tbaa !5
  %154 = sub nsw i64 %150, %153
  %155 = srem i64 %154, 1000000007
  %156 = load i64, ptr %3, align 8, !tbaa !5
  %157 = load i64, ptr %4, align 8, !tbaa !5
  %158 = call noundef i32 @_Z5solveiixx(i32 noundef %144, i32 noundef %146, i64 noundef %156, i64 noundef %157)
  %159 = sext i32 %158 to i64
  %160 = mul nsw i64 %155, %159
  %161 = add nsw i64 %160, %148
  %162 = srem i64 %161, 1000000007
  %163 = trunc nsw i64 %162 to i32
  %.pre135 = load i32, ptr @tot, align 4, !tbaa !9
  br label %164

164:                                              ; preds = %.lr.ph104, %147
  %165 = phi i32 [ %.pre135, %147 ], [ %142, %.lr.ph104 ]
  %.1 = phi i32 [ %163, %147 ], [ %.056101, %.lr.ph104 ]
  %indvars.iv.next133 = add nuw nsw i64 %indvars.iv132, 1
  %166 = sext i32 %165 to i64
  %167 = icmp slt i64 %indvars.iv.next133, %166
  br i1 %167, label %.lr.ph104, label %._crit_edge105, !llvm.loop !20
}

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef ptr @_ZSt11lower_boundIPxxET_S1_S1_RKT0_(ptr noundef, ptr noundef, ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #5

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

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

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

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

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

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


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