; LLVM IR from lzyrapx/Competitive-Programming :: HDUOJ (5799)

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

%struct.QUERY = type { i32, i32, i32, i32, i32, i32 }

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@a = external dso_local global [100010 x i32], align 16
@b = external dso_local global [100010 x i32], align 16
@head = external dso_local global [100010 x i32], align 16
@ne = external dso_local global i32, align 4
@idx = external dso_local global i32, align 4
@L = external dso_local global [100010 x i32], align 16
@R = external dso_local global [100010 x i32], align 16
@is = external dso_local global [100010 x i32], align 16
@st = external dso_local global [100010 x i32], align 16
@stn = external dso_local global i32, align 4
@pos = external dso_local global [100010 x i32], align 16
@b_cnt = external dso_local global i32, align 4
@qr1 = external dso_local global [100010 x %struct.QUERY], align 16
@qr2 = external dso_local global [100010 x %struct.QUERY], align 16
@num = external dso_local global [100010 x i32], align 16
@dis = external dso_local global [100010 x i32], align 16
@dlen = external dso_local global i32, align 4
@res = external dso_local global [100010 x i64], align 16
@ans = external dso_local global [100010 x i64], align 16
@in = external dso_local global [100010 x i8], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [1 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z3dfsii(i32 noundef, i32 noundef) #0

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN5QUERYC2Eiiiii(ptr noundef nonnull align 4 dereferenceable(24), i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef) unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z4cmpdRK5QUERYS1_(ptr noundef nonnull align 4 dereferenceable(24), ptr noundef nonnull align 4 dereferenceable(24)) #2

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z4moveii(i32 noundef, i32 noundef) #0

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z5printx(i64 noundef) #0

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #3 {
  %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 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
  %18 = alloca %struct.QUERY, align 4
  %19 = alloca %struct.QUERY, align 4
  %20 = alloca i32, align 4
  %21 = alloca i32, align 4
  %22 = alloca i32, align 4
  %23 = alloca i32, align 4
  %24 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #9
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #9
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #9
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #9
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #9
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #9
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #9
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #9
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #9
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #9
  %25 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %2)
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #9
  store i32 1, ptr %12, align 4, !tbaa !5
  br label %26

26:                                               ; preds = %362, %0
  %27 = load i32, ptr %12, align 4, !tbaa !5
  %28 = load i32, ptr %2, align 4, !tbaa !5
  %29 = icmp sle i32 %27, %28
  br i1 %29, label %31, label %30

30:                                               ; preds = %26
  store i32 2, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #9
  br label %365

31:                                               ; preds = %26
  store i32 0, ptr @ne, align 4, !tbaa !5
  call void @llvm.memset.p0.i64(ptr align 16 @head, i8 -1, i64 400040, i1 false)
  call void @_Z4readRi(ptr noundef nonnull align 4 dereferenceable(4) @n)
  call void @_Z4readRi(ptr noundef nonnull align 4 dereferenceable(4) @m)
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #9
  store i32 1, ptr %14, align 4, !tbaa !5
  br label %32

32:                                               ; preds = %49, %31
  %33 = load i32, ptr %14, align 4, !tbaa !5
  %34 = load i32, ptr @n, align 4, !tbaa !5
  %35 = icmp sle i32 %33, %34
  br i1 %35, label %37, label %36

36:                                               ; preds = %32
  store i32 5, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #9
  br label %52

37:                                               ; preds = %32
  %38 = load i32, ptr %14, align 4, !tbaa !5
  %39 = sext i32 %38 to i64
  %40 = getelementptr inbounds [100010 x i32], ptr @a, i64 0, i64 %39
  call void @_Z4readRi(ptr noundef nonnull align 4 dereferenceable(4) %40)
  %41 = load i32, ptr %14, align 4, !tbaa !5
  %42 = sext i32 %41 to i64
  %43 = getelementptr inbounds [100010 x i32], ptr @a, i64 0, i64 %42
  %44 = load i32, ptr %43, align 4, !tbaa !5
  %45 = load i32, ptr %14, align 4, !tbaa !5
  %46 = sub nsw i32 %45, 1
  %47 = sext i32 %46 to i64
  %48 = getelementptr inbounds [100010 x i32], ptr @dis, i64 0, i64 %47
  store i32 %44, ptr %48, align 4, !tbaa !5
  br label %49

49:                                               ; preds = %37
  %50 = load i32, ptr %14, align 4, !tbaa !5
  %51 = add nsw i32 %50, 1
  store i32 %51, ptr %14, align 4, !tbaa !5
  br label %32, !llvm.loop !9

52:                                               ; preds = %36
  %53 = load i32, ptr @n, align 4, !tbaa !5
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds i32, ptr @dis, i64 %54
  call void @_ZSt4sortIPiEvT_S1_(ptr noundef @dis, ptr noundef %55)
  %56 = load i32, ptr @n, align 4, !tbaa !5
  %57 = sext i32 %56 to i64
  %58 = getelementptr inbounds i32, ptr @dis, i64 %57
  %59 = call noundef ptr @_ZSt6uniqueIPiET_S1_S1_(ptr noundef @dis, ptr noundef %58)
  %60 = ptrtoint ptr %59 to i64
  %61 = sub i64 %60, ptrtoint (ptr @dis to i64)
  %62 = sdiv exact i64 %61, 4
  %63 = trunc i64 %62 to i32
  store i32 %63, ptr @dlen, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #9
  store i32 1, ptr %15, align 4, !tbaa !5
  br label %64

64:                                               ; preds = %84, %52
  %65 = load i32, ptr %15, align 4, !tbaa !5
  %66 = load i32, ptr @n, align 4, !tbaa !5
  %67 = icmp sle i32 %65, %66
  br i1 %67, label %69, label %68

68:                                               ; preds = %64
  store i32 8, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #9
  br label %87

69:                                               ; preds = %64
  %70 = load i32, ptr @dlen, align 4, !tbaa !5
  %71 = sext i32 %70 to i64
  %72 = getelementptr inbounds i32, ptr @dis, i64 %71
  %73 = load i32, ptr %15, align 4, !tbaa !5
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds [100010 x i32], ptr @a, i64 0, i64 %74
  %76 = call noundef ptr @_ZSt11lower_boundIPiiET_S1_S1_RKT0_(ptr noundef @dis, ptr noundef %72, ptr noundef nonnull align 4 dereferenceable(4) %75)
  %77 = ptrtoint ptr %76 to i64
  %78 = sub i64 %77, ptrtoint (ptr @dis to i64)
  %79 = sdiv exact i64 %78, 4
  %80 = trunc i64 %79 to i32
  %81 = load i32, ptr %15, align 4, !tbaa !5
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds [100010 x i32], ptr @b, i64 0, i64 %82
  store i32 %80, ptr %83, align 4, !tbaa !5
  br label %84

84:                                               ; preds = %69
  %85 = load i32, ptr %15, align 4, !tbaa !5
  %86 = add nsw i32 %85, 1
  store i32 %86, ptr %15, align 4, !tbaa !5
  br label %64, !llvm.loop !11

87:                                               ; preds = %68
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #9
  store i32 2, ptr %16, align 4, !tbaa !5
  br label %88

88:                                               ; preds = %98, %87
  %89 = load i32, ptr %16, align 4, !tbaa !5
  %90 = load i32, ptr @n, align 4, !tbaa !5
  %91 = icmp sle i32 %89, %90
  br i1 %91, label %93, label %92

92:                                               ; preds = %88
  store i32 11, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #9
  br label %101

93:                                               ; preds = %88
  call void @_Z4readRi(ptr noundef nonnull align 4 dereferenceable(4) %3)
  call void @_Z4readRi(ptr noundef nonnull align 4 dereferenceable(4) %4)
  %94 = load i32, ptr %3, align 4, !tbaa !5
  %95 = load i32, ptr %4, align 4, !tbaa !5
  call void @_Z3addii(i32 noundef %94, i32 noundef %95)
  %96 = load i32, ptr %4, align 4, !tbaa !5
  %97 = load i32, ptr %3, align 4, !tbaa !5
  call void @_Z3addii(i32 noundef %96, i32 noundef %97)
  br label %98

98:                                               ; preds = %93
  %99 = load i32, ptr %16, align 4, !tbaa !5
  %100 = add nsw i32 %99, 1
  store i32 %100, ptr %16, align 4, !tbaa !5
  br label %88, !llvm.loop !12

101:                                              ; preds = %92
  store i32 0, ptr @idx, align 4, !tbaa !5
  store i32 0, ptr @b_cnt, align 4, !tbaa !5
  %102 = call noundef i32 @_Z3dfsii(i32 noundef 1, i32 noundef 0)
  br label %103

103:                                              ; preds = %106, %101
  %104 = load i32, ptr @stn, align 4, !tbaa !5
  %105 = icmp ne i32 %104, 0
  br i1 %105, label %106, label %115

106:                                              ; preds = %103
  %107 = load i32, ptr @b_cnt, align 4, !tbaa !5
  %108 = load i32, ptr @stn, align 4, !tbaa !5
  %109 = add nsw i32 %108, -1
  store i32 %109, ptr @stn, align 4, !tbaa !5
  %110 = sext i32 %109 to i64
  %111 = getelementptr inbounds [100010 x i32], ptr @st, i64 0, i64 %110
  %112 = load i32, ptr %111, align 4, !tbaa !5
  %113 = sext i32 %112 to i64
  %114 = getelementptr inbounds [100010 x i32], ptr @pos, i64 0, i64 %113
  store i32 %107, ptr %114, align 4, !tbaa !5
  br label %103, !llvm.loop !13

115:                                              ; preds = %103
  store i32 0, ptr %11, align 4, !tbaa !5
  store i32 0, ptr %10, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #9
  store i32 0, ptr %17, align 4, !tbaa !5
  br label %116

116:                                              ; preds = %151, %115
  %117 = load i32, ptr %17, align 4, !tbaa !5
  %118 = load i32, ptr @m, align 4, !tbaa !5
  %119 = icmp slt i32 %117, %118
  br i1 %119, label %121, label %120

120:                                              ; preds = %116
  store i32 16, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #9
  br label %154

121:                                              ; preds = %116
  call void @_Z4readRi(ptr noundef nonnull align 4 dereferenceable(4) %5)
  call void @_Z4readRi(ptr noundef nonnull align 4 dereferenceable(4) %3)
  call void @_Z4readRi(ptr noundef nonnull align 4 dereferenceable(4) %4)
  call void @_Z4readRi(ptr noundef nonnull align 4 dereferenceable(4) %8)
  call void @_Z4readRi(ptr noundef nonnull align 4 dereferenceable(4) %9)
  %122 = load i32, ptr %5, align 4, !tbaa !5
  %123 = icmp eq i32 %122, 1
  br i1 %123, label %124, label %140

124:                                              ; preds = %121
  call void @llvm.lifetime.start.p0(i64 24, ptr %18) #9
  %125 = load i32, ptr %3, align 4, !tbaa !5
  %126 = sext i32 %125 to i64
  %127 = getelementptr inbounds [100010 x i32], ptr @L, i64 0, i64 %126
  %128 = load i32, ptr %127, align 4, !tbaa !5
  %129 = load i32, ptr %4, align 4, !tbaa !5
  %130 = sext i32 %129 to i64
  %131 = getelementptr inbounds [100010 x i32], ptr @R, i64 0, i64 %130
  %132 = load i32, ptr %131, align 4, !tbaa !5
  %133 = load i32, ptr %8, align 4, !tbaa !5
  %134 = load i32, ptr %9, align 4, !tbaa !5
  %135 = load i32, ptr %17, align 4, !tbaa !5
  call void @_ZN5QUERYC2Eiiiii(ptr noundef nonnull align 4 dereferenceable(24) %18, i32 noundef %128, i32 noundef %132, i32 noundef %133, i32 noundef %134, i32 noundef %135)
  %136 = load i32, ptr %10, align 4, !tbaa !5
  %137 = add nsw i32 %136, 1
  store i32 %137, ptr %10, align 4, !tbaa !5
  %138 = sext i32 %136 to i64
  %139 = getelementptr inbounds [100010 x %struct.QUERY], ptr @qr1, i64 0, i64 %138
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %139, ptr align 4 %18, i64 24, i1 false), !tbaa.struct !14
  call void @llvm.lifetime.end.p0(i64 24, ptr %18) #9
  br label %150

140:                                              ; preds = %121
  call void @llvm.lifetime.start.p0(i64 24, ptr %19) #9
  %141 = load i32, ptr %3, align 4, !tbaa !5
  %142 = load i32, ptr %4, align 4, !tbaa !5
  %143 = load i32, ptr %8, align 4, !tbaa !5
  %144 = load i32, ptr %9, align 4, !tbaa !5
  %145 = load i32, ptr %17, align 4, !tbaa !5
  call void @_ZN5QUERYC2Eiiiii(ptr noundef nonnull align 4 dereferenceable(24) %19, i32 noundef %141, i32 noundef %142, i32 noundef %143, i32 noundef %144, i32 noundef %145)
  %146 = load i32, ptr %11, align 4, !tbaa !5
  %147 = add nsw i32 %146, 1
  store i32 %147, ptr %11, align 4, !tbaa !5
  %148 = sext i32 %146 to i64
  %149 = getelementptr inbounds [100010 x %struct.QUERY], ptr @qr2, i64 0, i64 %148
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %149, ptr align 4 %19, i64 24, i1 false), !tbaa.struct !14
  call void @llvm.lifetime.end.p0(i64 24, ptr %19) #9
  br label %150

150:                                              ; preds = %140, %124
  br label %151

151:                                              ; preds = %150
  %152 = load i32, ptr %17, align 4, !tbaa !5
  %153 = add nsw i32 %152, 1
  store i32 %153, ptr %17, align 4, !tbaa !5
  br label %116, !llvm.loop !15

154:                                              ; preds = %120
  %155 = load i32, ptr %10, align 4, !tbaa !5
  %156 = sext i32 %155 to i64
  %157 = getelementptr inbounds %struct.QUERY, ptr @qr1, i64 %156
  call void @_ZSt4sortIP5QUERYEvT_S2_(ptr noundef @qr1, ptr noundef %157)
  call void @llvm.memset.p0.i64(ptr align 16 @num, i8 0, i64 400040, i1 false)
  call void @llvm.memset.p0.i64(ptr align 16 @res, i8 0, i64 800080, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #9
  store i32 1, ptr %20, align 4, !tbaa !5
  br label %158

158:                                              ; preds = %171, %154
  %159 = load i32, ptr %20, align 4, !tbaa !5
  %160 = load i32, ptr @n, align 4, !tbaa !5
  %161 = icmp sle i32 %159, %160
  br i1 %161, label %163, label %162

162:                                              ; preds = %158
  store i32 19, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #9
  br label %174

163:                                              ; preds = %158
  %164 = load i32, ptr %20, align 4, !tbaa !5
  %165 = sext i32 %164 to i64
  %166 = getelementptr inbounds [100010 x i32], ptr @a, i64 0, i64 %165
  %167 = load i32, ptr %166, align 4, !tbaa !5
  %168 = sext i32 %167 to i64
  %169 = load i64, ptr @res, align 16, !tbaa !16
  %170 = add nsw i64 %169, %168
  store i64 %170, ptr @res, align 16, !tbaa !16
  br label %171

171:                                              ; preds = %163
  %172 = load i32, ptr %20, align 4, !tbaa !5
  %173 = add nsw i32 %172, 1
  store i32 %173, ptr %20, align 4, !tbaa !5
  br label %158, !llvm.loop !18

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

175:                                              ; preds = %265, %174
  %176 = load i32, ptr %21, align 4, !tbaa !5
  %177 = load i32, ptr %10, align 4, !tbaa !5
  %178 = icmp slt i32 %176, %177
  br i1 %178, label %180, label %179

179:                                              ; preds = %175
  store i32 22, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #9
  br label %268

180:                                              ; preds = %175
  br label %181

181:                                              ; preds = %189, %180
  %182 = load i32, ptr %7, align 4, !tbaa !5
  %183 = load i32, ptr %21, align 4, !tbaa !5
  %184 = sext i32 %183 to i64
  %185 = getelementptr inbounds [100010 x %struct.QUERY], ptr @qr1, i64 0, i64 %184
  %186 = getelementptr inbounds %struct.QUERY, ptr %185, i32 0, i32 1
  %187 = load i32, ptr %186, align 4, !tbaa !19
  %188 = icmp slt i32 %182, %187
  br i1 %188, label %189, label %195

189:                                              ; preds = %181
  %190 = load i32, ptr %7, align 4, !tbaa !5
  %191 = add nsw i32 %190, 1
  store i32 %191, ptr %7, align 4, !tbaa !5
  %192 = sext i32 %191 to i64
  %193 = getelementptr inbounds [100010 x i32], ptr @is, i64 0, i64 %192
  %194 = load i32, ptr %193, align 4, !tbaa !5
  call void @_Z3addi(i32 noundef %194)
  br label %181, !llvm.loop !21

195:                                              ; preds = %181
  br label %196

196:                                              ; preds = %204, %195
  %197 = load i32, ptr %6, align 4, !tbaa !5
  %198 = load i32, ptr %21, align 4, !tbaa !5
  %199 = sext i32 %198 to i64
  %200 = getelementptr inbounds [100010 x %struct.QUERY], ptr @qr1, i64 0, i64 %199
  %201 = getelementptr inbounds %struct.QUERY, ptr %200, i32 0, i32 0
  %202 = load i32, ptr %201, align 8, !tbaa !22
  %203 = icmp slt i32 %197, %202
  br i1 %203, label %204, label %210

204:                                              ; preds = %196
  %205 = load i32, ptr %6, align 4, !tbaa !5
  %206 = add nsw i32 %205, 1
  store i32 %206, ptr %6, align 4, !tbaa !5
  %207 = sext i32 %205 to i64
  %208 = getelementptr inbounds [100010 x i32], ptr @is, i64 0, i64 %207
  %209 = load i32, ptr %208, align 4, !tbaa !5
  call void @_Z6removei(i32 noundef %209)
  br label %196, !llvm.loop !23

210:                                              ; preds = %196
  br label %211

211:                                              ; preds = %219, %210
  %212 = load i32, ptr %7, align 4, !tbaa !5
  %213 = load i32, ptr %21, align 4, !tbaa !5
  %214 = sext i32 %213 to i64
  %215 = getelementptr inbounds [100010 x %struct.QUERY], ptr @qr1, i64 0, i64 %214
  %216 = getelementptr inbounds %struct.QUERY, ptr %215, i32 0, i32 1
  %217 = load i32, ptr %216, align 4, !tbaa !19
  %218 = icmp sgt i32 %212, %217
  br i1 %218, label %219, label %225

219:                                              ; preds = %211
  %220 = load i32, ptr %7, align 4, !tbaa !5
  %221 = add nsw i32 %220, -1
  store i32 %221, ptr %7, align 4, !tbaa !5
  %222 = sext i32 %220 to i64
  %223 = getelementptr inbounds [100010 x i32], ptr @is, i64 0, i64 %222
  %224 = load i32, ptr %223, align 4, !tbaa !5
  call void @_Z6removei(i32 noundef %224)
  br label %211, !llvm.loop !24

225:                                              ; preds = %211
  br label %226

226:                                              ; preds = %234, %225
  %227 = load i32, ptr %6, align 4, !tbaa !5
  %228 = load i32, ptr %21, align 4, !tbaa !5
  %229 = sext i32 %228 to i64
  %230 = getelementptr inbounds [100010 x %struct.QUERY], ptr @qr1, i64 0, i64 %229
  %231 = getelementptr inbounds %struct.QUERY, ptr %230, i32 0, i32 0
  %232 = load i32, ptr %231, align 8, !tbaa !22
  %233 = icmp sgt i32 %227, %232
  br i1 %233, label %234, label %240

234:                                              ; preds = %226
  %235 = load i32, ptr %6, align 4, !tbaa !5
  %236 = add nsw i32 %235, -1
  store i32 %236, ptr %6, align 4, !tbaa !5
  %237 = sext i32 %236 to i64
  %238 = getelementptr inbounds [100010 x i32], ptr @is, i64 0, i64 %237
  %239 = load i32, ptr %238, align 4, !tbaa !5
  call void @_Z3addi(i32 noundef %239)
  br label %226, !llvm.loop !25

240:                                              ; preds = %226
  %241 = load i32, ptr %21, align 4, !tbaa !5
  %242 = sext i32 %241 to i64
  %243 = getelementptr inbounds [100010 x %struct.QUERY], ptr @qr1, i64 0, i64 %242
  %244 = getelementptr inbounds %struct.QUERY, ptr %243, i32 0, i32 3
  %245 = load i32, ptr %244, align 4, !tbaa !26
  %246 = sext i32 %245 to i64
  %247 = getelementptr inbounds [100010 x i64], ptr @res, i64 0, i64 %246
  %248 = load i64, ptr %247, align 8, !tbaa !16
  %249 = load i32, ptr %21, align 4, !tbaa !5
  %250 = sext i32 %249 to i64
  %251 = getelementptr inbounds [100010 x %struct.QUERY], ptr @qr1, i64 0, i64 %250
  %252 = getelementptr inbounds %struct.QUERY, ptr %251, i32 0, i32 4
  %253 = load i32, ptr %252, align 8, !tbaa !27
  %254 = sext i32 %253 to i64
  %255 = getelementptr inbounds [100010 x i64], ptr @res, i64 0, i64 %254
  %256 = load i64, ptr %255, align 8, !tbaa !16
  %257 = call noundef i64 @_ZSt5__gcdIxET_S0_S0_(i64 noundef %248, i64 noundef %256)
  %258 = load i32, ptr %21, align 4, !tbaa !5
  %259 = sext i32 %258 to i64
  %260 = getelementptr inbounds [100010 x %struct.QUERY], ptr @qr1, i64 0, i64 %259
  %261 = getelementptr inbounds %struct.QUERY, ptr %260, i32 0, i32 5
  %262 = load i32, ptr %261, align 4, !tbaa !28
  %263 = sext i32 %262 to i64
  %264 = getelementptr inbounds [100010 x i64], ptr @ans, i64 0, i64 %263
  store i64 %257, ptr %264, align 8, !tbaa !16
  br label %265

265:                                              ; preds = %240
  %266 = load i32, ptr %21, align 4, !tbaa !5
  %267 = add nsw i32 %266, 1
  store i32 %267, ptr %21, align 4, !tbaa !5
  br label %175, !llvm.loop !29

268:                                              ; preds = %179
  %269 = load i32, ptr %11, align 4, !tbaa !5
  %270 = sext i32 %269 to i64
  %271 = getelementptr inbounds %struct.QUERY, ptr @qr2, i64 %270
  call void @_ZSt4sortIP5QUERYPFbRKS0_S3_EEvT_S6_T0_(ptr noundef @qr2, ptr noundef %271, ptr noundef @_Z4cmpdRK5QUERYS1_)
  call void @llvm.memset.p0.i64(ptr align 16 @num, i8 0, i64 400040, i1 false)
  call void @llvm.memset.p0.i64(ptr align 16 @res, i8 0, i64 800080, i1 false)
  call void @llvm.memset.p0.i64(ptr align 16 @in, i8 0, i64 100010, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #9
  store i32 1, ptr %22, align 4, !tbaa !5
  br label %272

272:                                              ; preds = %285, %268
  %273 = load i32, ptr %22, align 4, !tbaa !5
  %274 = load i32, ptr @n, align 4, !tbaa !5
  %275 = icmp sle i32 %273, %274
  br i1 %275, label %277, label %276

276:                                              ; preds = %272
  store i32 33, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #9
  br label %288

277:                                              ; preds = %272
  %278 = load i32, ptr %22, align 4, !tbaa !5
  %279 = sext i32 %278 to i64
  %280 = getelementptr inbounds [100010 x i32], ptr @a, i64 0, i64 %279
  %281 = load i32, ptr %280, align 4, !tbaa !5
  %282 = sext i32 %281 to i64
  %283 = load i64, ptr @res, align 16, !tbaa !16
  %284 = add nsw i64 %283, %282
  store i64 %284, ptr @res, align 16, !tbaa !16
  br label %285

285:                                              ; preds = %277
  %286 = load i32, ptr %22, align 4, !tbaa !5
  %287 = add nsw i32 %286, 1
  store i32 %287, ptr %22, align 4, !tbaa !5
  br label %272, !llvm.loop !30

288:                                              ; preds = %276
  store i32 1, ptr %7, align 4, !tbaa !5
  store i32 1, ptr %6, align 4, !tbaa !5
  call void @_Z3addi(i32 noundef 1)
  store i8 1, ptr getelementptr inbounds ([100010 x i8], ptr @in, i64 0, i64 1), align 1, !tbaa !31
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #9
  store i32 0, ptr %23, align 4, !tbaa !5
  br label %289

289:                                              ; preds = %341, %288
  %290 = load i32, ptr %23, align 4, !tbaa !5
  %291 = load i32, ptr %11, align 4, !tbaa !5
  %292 = icmp slt i32 %290, %291
  br i1 %292, label %294, label %293

293:                                              ; preds = %289
  store i32 36, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #9
  br label %344

294:                                              ; preds = %289
  %295 = load i32, ptr %6, align 4, !tbaa !5
  %296 = load i32, ptr %23, align 4, !tbaa !5
  %297 = sext i32 %296 to i64
  %298 = getelementptr inbounds [100010 x %struct.QUERY], ptr @qr2, i64 0, i64 %297
  %299 = getelementptr inbounds %struct.QUERY, ptr %298, i32 0, i32 0
  %300 = load i32, ptr %299, align 8, !tbaa !22
  call void @_Z4moveii(i32 noundef %295, i32 noundef %300)
  %301 = load i32, ptr %7, align 4, !tbaa !5
  %302 = load i32, ptr %23, align 4, !tbaa !5
  %303 = sext i32 %302 to i64
  %304 = getelementptr inbounds [100010 x %struct.QUERY], ptr @qr2, i64 0, i64 %303
  %305 = getelementptr inbounds %struct.QUERY, ptr %304, i32 0, i32 1
  %306 = load i32, ptr %305, align 4, !tbaa !19
  call void @_Z4moveii(i32 noundef %301, i32 noundef %306)
  %307 = load i32, ptr %23, align 4, !tbaa !5
  %308 = sext i32 %307 to i64
  %309 = getelementptr inbounds [100010 x %struct.QUERY], ptr @qr2, i64 0, i64 %308
  %310 = getelementptr inbounds %struct.QUERY, ptr %309, i32 0, i32 0
  %311 = load i32, ptr %310, align 8, !tbaa !22
  store i32 %311, ptr %6, align 4, !tbaa !5
  %312 = load i32, ptr %23, align 4, !tbaa !5
  %313 = sext i32 %312 to i64
  %314 = getelementptr inbounds [100010 x %struct.QUERY], ptr @qr2, i64 0, i64 %313
  %315 = getelementptr inbounds %struct.QUERY, ptr %314, i32 0, i32 1
  %316 = load i32, ptr %315, align 4, !tbaa !19
  store i32 %316, ptr %7, align 4, !tbaa !5
  %317 = load i32, ptr %23, align 4, !tbaa !5
  %318 = sext i32 %317 to i64
  %319 = getelementptr inbounds [100010 x %struct.QUERY], ptr @qr2, i64 0, i64 %318
  %320 = getelementptr inbounds %struct.QUERY, ptr %319, i32 0, i32 3
  %321 = load i32, ptr %320, align 4, !tbaa !26
  %322 = sext i32 %321 to i64
  %323 = getelementptr inbounds [100010 x i64], ptr @res, i64 0, i64 %322
  %324 = load i64, ptr %323, align 8, !tbaa !16
  %325 = load i32, ptr %23, align 4, !tbaa !5
  %326 = sext i32 %325 to i64
  %327 = getelementptr inbounds [100010 x %struct.QUERY], ptr @qr2, i64 0, i64 %326
  %328 = getelementptr inbounds %struct.QUERY, ptr %327, i32 0, i32 4
  %329 = load i32, ptr %328, align 8, !tbaa !27
  %330 = sext i32 %329 to i64
  %331 = getelementptr inbounds [100010 x i64], ptr @res, i64 0, i64 %330
  %332 = load i64, ptr %331, align 8, !tbaa !16
  %333 = call noundef i64 @_ZSt5__gcdIxET_S0_S0_(i64 noundef %324, i64 noundef %332)
  %334 = load i32, ptr %23, align 4, !tbaa !5
  %335 = sext i32 %334 to i64
  %336 = getelementptr inbounds [100010 x %struct.QUERY], ptr @qr2, i64 0, i64 %335
  %337 = getelementptr inbounds %struct.QUERY, ptr %336, i32 0, i32 5
  %338 = load i32, ptr %337, align 4, !tbaa !28
  %339 = sext i32 %338 to i64
  %340 = getelementptr inbounds [100010 x i64], ptr @ans, i64 0, i64 %339
  store i64 %333, ptr %340, align 8, !tbaa !16
  br label %341

341:                                              ; preds = %294
  %342 = load i32, ptr %23, align 4, !tbaa !5
  %343 = add nsw i32 %342, 1
  store i32 %343, ptr %23, align 4, !tbaa !5
  br label %289, !llvm.loop !33

344:                                              ; preds = %293
  %345 = load i32, ptr %12, align 4, !tbaa !5
  %346 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, i32 noundef %345)
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #9
  store i32 0, ptr %24, align 4, !tbaa !5
  br label %347

347:                                              ; preds = %358, %344
  %348 = load i32, ptr %24, align 4, !tbaa !5
  %349 = load i32, ptr @m, align 4, !tbaa !5
  %350 = icmp slt i32 %348, %349
  br i1 %350, label %352, label %351

351:                                              ; preds = %347
  store i32 39, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #9
  br label %361

352:                                              ; preds = %347
  %353 = load i32, ptr %24, align 4, !tbaa !5
  %354 = sext i32 %353 to i64
  %355 = getelementptr inbounds [100010 x i64], ptr @ans, i64 0, i64 %354
  %356 = load i64, ptr %355, align 8, !tbaa !16
  call void @_Z5printx(i64 noundef %356)
  %357 = call i32 @puts(ptr noundef @.str.4)
  br label %358

358:                                              ; preds = %352
  %359 = load i32, ptr %24, align 4, !tbaa !5
  %360 = add nsw i32 %359, 1
  store i32 %360, ptr %24, align 4, !tbaa !5
  br label %347, !llvm.loop !34

361:                                              ; preds = %351
  br label %362

362:                                              ; preds = %361
  %363 = load i32, ptr %12, align 4, !tbaa !5
  %364 = add nsw i32 %363, 1
  store i32 %364, ptr %12, align 4, !tbaa !5
  br label %26, !llvm.loop !35

365:                                              ; preds = %30
  store i32 0, ptr %1, align 4
  store i32 1, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #9
  %366 = load i32, ptr %1, align 4
  ret i32 %366
}

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #5

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_Z3addii(i32 noundef, i32 noundef) #7

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_Z3addi(i32 noundef) #7

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_Z6removei(i32 noundef) #7

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

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

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

declare i32 @puts(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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { 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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { 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 #7 = { 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 #8 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #9 = { 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 = !{i64 0, i64 4, !5, i64 4, i64 4, !5, i64 8, i64 4, !5, i64 12, i64 4, !5, i64 16, i64 4, !5, i64 20, i64 4, !5}
!15 = distinct !{!15, !10}
!16 = !{!17, !17, i64 0}
!17 = !{!"long long", !7, i64 0}
!18 = distinct !{!18, !10}
!19 = !{!20, !6, i64 4}
!20 = !{!"_ZTS5QUERY", !6, i64 0, !6, i64 4, !6, i64 8, !6, i64 12, !6, i64 16, !6, i64 20}
!21 = distinct !{!21, !10}
!22 = !{!20, !6, i64 0}
!23 = distinct !{!23, !10}
!24 = distinct !{!24, !10}
!25 = distinct !{!25, !10}
!26 = !{!20, !6, i64 12}
!27 = !{!20, !6, i64 16}
!28 = !{!20, !6, i64 20}
!29 = distinct !{!29, !10}
!30 = distinct !{!30, !10}
!31 = !{!32, !32, i64 0}
!32 = !{!"bool", !7, i64 0}
!33 = distinct !{!33, !10}
!34 = distinct !{!34, !10}
!35 = distinct !{!35, !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"

%struct.QUERY = type { i32, i32, i32, i32, i32, i32 }

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@a = external dso_local global [100010 x i32], align 16
@b = external dso_local local_unnamed_addr global [100010 x i32], align 16
@head = external dso_local local_unnamed_addr global [100010 x i32], align 16
@ne = external dso_local local_unnamed_addr global i32, align 4
@idx = external dso_local local_unnamed_addr global i32, align 4
@L = external dso_local local_unnamed_addr global [100010 x i32], align 16
@R = external dso_local local_unnamed_addr global [100010 x i32], align 16
@is = external dso_local local_unnamed_addr global [100010 x i32], align 16
@st = external dso_local local_unnamed_addr global [100010 x i32], align 16
@stn = external dso_local local_unnamed_addr global i32, align 4
@pos = external dso_local local_unnamed_addr global [100010 x i32], align 16
@b_cnt = external dso_local local_unnamed_addr global i32, align 4
@qr1 = external dso_local global [100010 x %struct.QUERY], align 16
@qr2 = external dso_local global [100010 x %struct.QUERY], align 16
@num = external dso_local local_unnamed_addr global [100010 x i32], align 16
@dis = external dso_local global [100010 x i32], align 16
@dlen = external dso_local local_unnamed_addr global i32, align 4
@res = external dso_local local_unnamed_addr global [100010 x i64], align 16
@ans = external dso_local local_unnamed_addr global [100010 x i64], align 16
@in = external dso_local local_unnamed_addr global [100010 x i8], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [1 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z3dfsii(i32 noundef, i32 noundef) local_unnamed_addr #0

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN5QUERYC2Eiiiii(ptr noundef nonnull align 4 dereferenceable(24), i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef) unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z4cmpdRK5QUERYS1_(ptr noundef nonnull align 4 dereferenceable(24), ptr noundef nonnull align 4 dereferenceable(24)) #2

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z4moveii(i32 noundef, i32 noundef) local_unnamed_addr #0

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #3 {
  %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 %struct.QUERY, align 4
  %8 = alloca %struct.QUERY, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #10
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #10
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #10
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #10
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #10
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #10
  %9 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1)
  %10 = load i32, ptr %1, align 4, !tbaa !5
  %.not159 = icmp slt i32 %10, 1
  br i1 %.not159, label %._crit_edge163, label %.lr.ph162

._crit_edge163:                                   ; preds = %._crit_edge158, %0
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #10
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #10
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #10
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #10
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #10
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #10
  ret i32 0

.lr.ph162:                                        ; preds = %0, %._crit_edge158
  %.070160 = phi i32 [ %218, %._crit_edge158 ], [ 1, %0 ]
  store i32 0, ptr @ne, align 4, !tbaa !5
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(400040) @head, i8 -1, i64 400040, i1 false)
  call void @_Z4readRi(ptr noundef nonnull align 4 dereferenceable(4) @n)
  call void @_Z4readRi(ptr noundef nonnull align 4 dereferenceable(4) @m)
  %11 = load i32, ptr @n, align 4, !tbaa !5
  %.not8296 = icmp slt i32 %11, 1
  br i1 %.not8296, label %.lr.ph162.._crit_edge_crit_edge, label %.lr.ph

.lr.ph162.._crit_edge_crit_edge:                  ; preds = %.lr.ph162
  %.pre213 = sext i32 %11 to i64
  br label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %.lr.ph162.._crit_edge_crit_edge
  %.pre-phi = phi i64 [ %.pre213, %.lr.ph162.._crit_edge_crit_edge ], [ %27, %.lr.ph ]
  %12 = getelementptr inbounds i32, ptr @dis, i64 %.pre-phi
  call void @_ZSt4sortIPiEvT_S1_(ptr noundef nonnull @dis, ptr noundef nonnull %12)
  %13 = load i32, ptr @n, align 4, !tbaa !5
  %14 = sext i32 %13 to i64
  %15 = getelementptr inbounds i32, ptr @dis, i64 %14
  %16 = call noundef ptr @_ZSt6uniqueIPiET_S1_S1_(ptr noundef nonnull @dis, ptr noundef nonnull %15)
  %17 = ptrtoint ptr %16 to i64
  %18 = sub i64 %17, ptrtoint (ptr @dis to i64)
  %19 = lshr exact i64 %18, 2
  %20 = trunc i64 %19 to i32
  store i32 %20, ptr @dlen, align 4, !tbaa !5
  %21 = load i32, ptr @n, align 4, !tbaa !5
  %.not8398 = icmp slt i32 %21, 1
  br i1 %.not8398, label %._crit_edge105, label %.lr.ph101

.lr.ph:                                           ; preds = %.lr.ph162, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 1, %.lr.ph162 ]
  %22 = getelementptr inbounds [100010 x i32], ptr @a, i64 0, i64 %indvars.iv
  call void @_Z4readRi(ptr noundef nonnull align 4 dereferenceable(4) %22)
  %23 = load i32, ptr %22, align 4, !tbaa !5
  %24 = add nsw i64 %indvars.iv, -1
  %25 = getelementptr inbounds [100010 x i32], ptr @dis, i64 0, i64 %24
  store i32 %23, ptr %25, align 4, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %26 = load i32, ptr @n, align 4, !tbaa !5
  %27 = sext i32 %26 to i64
  %.not82.not = icmp slt i64 %indvars.iv, %27
  br i1 %.not82.not, label %.lr.ph, label %._crit_edge, !llvm.loop !9

.preheader93:                                     ; preds = %.lr.ph101
  %.not84102 = icmp slt i32 %38, 2
  br i1 %.not84102, label %._crit_edge105, label %.lr.ph104

.lr.ph101:                                        ; preds = %._crit_edge, %.lr.ph101
  %indvars.iv173 = phi i64 [ %indvars.iv.next174, %.lr.ph101 ], [ 1, %._crit_edge ]
  %28 = load i32, ptr @dlen, align 4, !tbaa !5
  %29 = sext i32 %28 to i64
  %30 = getelementptr inbounds i32, ptr @dis, i64 %29
  %31 = getelementptr inbounds [100010 x i32], ptr @a, i64 0, i64 %indvars.iv173
  %32 = call noundef ptr @_ZSt11lower_boundIPiiET_S1_S1_RKT0_(ptr noundef nonnull @dis, ptr noundef nonnull %30, ptr noundef nonnull align 4 dereferenceable(4) %31)
  %33 = ptrtoint ptr %32 to i64
  %34 = sub i64 %33, ptrtoint (ptr @dis to i64)
  %35 = lshr exact i64 %34, 2
  %36 = trunc i64 %35 to i32
  %37 = getelementptr inbounds [100010 x i32], ptr @b, i64 0, i64 %indvars.iv173
  store i32 %36, ptr %37, align 4, !tbaa !5
  %indvars.iv.next174 = add nuw nsw i64 %indvars.iv173, 1
  %38 = load i32, ptr @n, align 4, !tbaa !5
  %39 = sext i32 %38 to i64
  %.not83.not = icmp slt i64 %indvars.iv173, %39
  br i1 %.not83.not, label %.lr.ph101, label %.preheader93, !llvm.loop !11

._crit_edge105:                                   ; preds = %.lr.ph104, %._crit_edge, %.preheader93
  store i32 0, ptr @idx, align 4, !tbaa !5
  store i32 0, ptr @b_cnt, align 4, !tbaa !5
  %40 = call noundef i32 @_Z3dfsii(i32 noundef 1, i32 noundef 0)
  %stn.promoted = load i32, ptr @stn, align 4, !tbaa !5
  %.not85106 = icmp eq i32 %stn.promoted, 0
  br i1 %.not85106, label %.preheader92, label %.lr.ph108

.lr.ph108:                                        ; preds = %._crit_edge105
  %41 = load i32, ptr @b_cnt, align 4, !tbaa !5
  %42 = sext i32 %stn.promoted to i64
  %xtraiter = and i64 %42, 3
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.prol.loopexit, label %.prol.preheader

.prol.preheader:                                  ; preds = %.lr.ph108, %.prol.preheader
  %indvars.iv176.prol = phi i64 [ %indvars.iv.next177.prol, %.prol.preheader ], [ %42, %.lr.ph108 ]
  %prol.iter = phi i64 [ %prol.iter.next, %.prol.preheader ], [ 0, %.lr.ph108 ]
  %indvars.iv.next177.prol = add nsw i64 %indvars.iv176.prol, -1
  %43 = getelementptr inbounds [100010 x i32], ptr @st, i64 0, i64 %indvars.iv.next177.prol
  %44 = load i32, ptr %43, align 4, !tbaa !5
  %45 = sext i32 %44 to i64
  %46 = getelementptr inbounds [100010 x i32], ptr @pos, i64 0, i64 %45
  store i32 %41, ptr %46, align 4, !tbaa !5
  %prol.iter.next = add i64 %prol.iter, 1
  %prol.iter.cmp.not = icmp eq i64 %prol.iter.next, %xtraiter
  br i1 %prol.iter.cmp.not, label %.prol.loopexit, label %.prol.preheader, !llvm.loop !12

.prol.loopexit:                                   ; preds = %.prol.preheader, %.lr.ph108
  %indvars.iv176.unr = phi i64 [ %42, %.lr.ph108 ], [ %indvars.iv.next177.prol, %.prol.preheader ]
  %47 = icmp ult i32 %stn.promoted, 4
  br i1 %47, label %..preheader92_crit_edge, label %.lr.ph108.new

.lr.ph104:                                        ; preds = %.preheader93, %.lr.ph104
  %.067103 = phi i32 [ %52, %.lr.ph104 ], [ 2, %.preheader93 ]
  call void @_Z4readRi(ptr noundef nonnull align 4 dereferenceable(4) %2)
  call void @_Z4readRi(ptr noundef nonnull align 4 dereferenceable(4) %3)
  %48 = load i32, ptr %2, align 4, !tbaa !5
  %49 = load i32, ptr %3, align 4, !tbaa !5
  call void @_Z3addii(i32 noundef %48, i32 noundef %49)
  %50 = load i32, ptr %3, align 4, !tbaa !5
  %51 = load i32, ptr %2, align 4, !tbaa !5
  call void @_Z3addii(i32 noundef %50, i32 noundef %51)
  %52 = add nuw nsw i32 %.067103, 1
  %53 = load i32, ptr @n, align 4, !tbaa !5
  %.not84.not = icmp slt i32 %.067103, %53
  br i1 %.not84.not, label %.lr.ph104, label %._crit_edge105, !llvm.loop !14

..preheader92_crit_edge:                          ; preds = %.lr.ph108.new, %.prol.loopexit
  store i32 0, ptr @stn, align 4, !tbaa !5
  br label %.preheader92

.preheader92:                                     ; preds = %..preheader92_crit_edge, %._crit_edge105
  %54 = load i32, ptr @m, align 4, !tbaa !5
  %55 = icmp sgt i32 %54, 0
  br i1 %55, label %.lr.ph113, label %._crit_edge114

.lr.ph108.new:                                    ; preds = %.prol.loopexit, %.lr.ph108.new
  %indvars.iv176 = phi i64 [ %indvars.iv.next177.3, %.lr.ph108.new ], [ %indvars.iv176.unr, %.prol.loopexit ]
  %indvars.iv.next177 = add nsw i64 %indvars.iv176, -1
  %56 = getelementptr inbounds [100010 x i32], ptr @st, i64 0, i64 %indvars.iv.next177
  %57 = load i32, ptr %56, align 4, !tbaa !5
  %58 = sext i32 %57 to i64
  %59 = getelementptr inbounds [100010 x i32], ptr @pos, i64 0, i64 %58
  store i32 %41, ptr %59, align 4, !tbaa !5
  %indvars.iv.next177.1 = add nsw i64 %indvars.iv176, -2
  %60 = getelementptr inbounds [100010 x i32], ptr @st, i64 0, i64 %indvars.iv.next177.1
  %61 = load i32, ptr %60, align 4, !tbaa !5
  %62 = sext i32 %61 to i64
  %63 = getelementptr inbounds [100010 x i32], ptr @pos, i64 0, i64 %62
  store i32 %41, ptr %63, align 4, !tbaa !5
  %indvars.iv.next177.2 = add nsw i64 %indvars.iv176, -3
  %64 = getelementptr inbounds [100010 x i32], ptr @st, i64 0, i64 %indvars.iv.next177.2
  %65 = load i32, ptr %64, align 4, !tbaa !5
  %66 = sext i32 %65 to i64
  %67 = getelementptr inbounds [100010 x i32], ptr @pos, i64 0, i64 %66
  store i32 %41, ptr %67, align 4, !tbaa !5
  %indvars.iv.next177.3 = add nsw i64 %indvars.iv176, -4
  %68 = getelementptr inbounds [100010 x i32], ptr @st, i64 0, i64 %indvars.iv.next177.3
  %69 = load i32, ptr %68, align 4, !tbaa !5
  %70 = sext i32 %69 to i64
  %71 = getelementptr inbounds [100010 x i32], ptr @pos, i64 0, i64 %70
  store i32 %41, ptr %71, align 4, !tbaa !5
  %.not85.3 = icmp eq i64 %indvars.iv.next177.3, 0
  br i1 %.not85.3, label %..preheader92_crit_edge, label %.lr.ph108.new, !llvm.loop !15

._crit_edge114:                                   ; preds = %109, %.preheader92
  %.072.lcssa = phi i32 [ 0, %.preheader92 ], [ %.173, %109 ]
  %.071.lcssa = phi i32 [ 0, %.preheader92 ], [ %.1, %109 ]
  %72 = sext i32 %.072.lcssa to i64
  %73 = getelementptr inbounds %struct.QUERY, ptr @qr1, i64 %72
  call void @_ZSt4sortIP5QUERYEvT_S2_(ptr noundef nonnull @qr1, ptr noundef nonnull %73)
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(400040) @num, i8 0, i64 400040, i1 false)
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(800080) @res, i8 0, i64 800080, i1 false)
  %74 = load i32, ptr @n, align 4, !tbaa !5
  %.not86117 = icmp slt i32 %74, 1
  br i1 %.not86117, label %.preheader91, label %.lr.ph120.preheader

.lr.ph120.preheader:                              ; preds = %._crit_edge114
  %75 = add nuw i32 %74, 1
  %wide.trip.count = zext i32 %75 to i64
  %76 = zext nneg i32 %74 to i64
  %min.iters.check229 = icmp ult i32 %74, 4
  br i1 %min.iters.check229, label %.lr.ph120.preheader247, label %vector.ph230

.lr.ph120.preheader247:                           ; preds = %middle.block227, %.lr.ph120.preheader
  %indvars.iv179.ph = phi i64 [ 1, %.lr.ph120.preheader ], [ %ind.end233, %middle.block227 ]
  %.ph248 = phi i64 [ 0, %.lr.ph120.preheader ], [ %84, %middle.block227 ]
  br label %.lr.ph120

vector.ph230:                                     ; preds = %.lr.ph120.preheader
  %n.vec232 = and i64 %76, 2147483644
  %ind.end233 = or disjoint i64 %n.vec232, 1
  br label %vector.body235

vector.body235:                                   ; preds = %vector.body235, %vector.ph230
  %index236 = phi i64 [ 0, %vector.ph230 ], [ %index.next242, %vector.body235 ]
  %vec.phi237 = phi <2 x i64> [ zeroinitializer, %vector.ph230 ], [ %81, %vector.body235 ]
  %vec.phi238 = phi <2 x i64> [ zeroinitializer, %vector.ph230 ], [ %82, %vector.body235 ]
  %offset.idx239 = or disjoint i64 %index236, 1
  %77 = getelementptr inbounds [100010 x i32], ptr @a, i64 0, i64 %offset.idx239
  %78 = getelementptr inbounds i8, ptr %77, i64 8
  %wide.load240 = load <2 x i32>, ptr %77, align 4, !tbaa !5
  %wide.load241 = load <2 x i32>, ptr %78, align 4, !tbaa !5
  %79 = sext <2 x i32> %wide.load240 to <2 x i64>
  %80 = sext <2 x i32> %wide.load241 to <2 x i64>
  %81 = add <2 x i64> %vec.phi237, %79
  %82 = add <2 x i64> %vec.phi238, %80
  %index.next242 = add nuw i64 %index236, 4
  %83 = icmp eq i64 %index.next242, %n.vec232
  br i1 %83, label %middle.block227, label %vector.body235, !llvm.loop !16

middle.block227:                                  ; preds = %vector.body235
  %bin.rdx243 = add <2 x i64> %82, %81
  %84 = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %bin.rdx243)
  %cmp.n244 = icmp eq i64 %n.vec232, %76
  br i1 %cmp.n244, label %..preheader91_crit_edge, label %.lr.ph120.preheader247

.lr.ph113:                                        ; preds = %.preheader92, %109
  %.066112 = phi i32 [ %110, %109 ], [ 0, %.preheader92 ]
  %.071111 = phi i32 [ %.1, %109 ], [ 0, %.preheader92 ]
  %.072110 = phi i32 [ %.173, %109 ], [ 0, %.preheader92 ]
  call void @_Z4readRi(ptr noundef nonnull align 4 dereferenceable(4) %4)
  call void @_Z4readRi(ptr noundef nonnull align 4 dereferenceable(4) %2)
  call void @_Z4readRi(ptr noundef nonnull align 4 dereferenceable(4) %3)
  call void @_Z4readRi(ptr noundef nonnull align 4 dereferenceable(4) %5)
  call void @_Z4readRi(ptr noundef nonnull align 4 dereferenceable(4) %6)
  %85 = load i32, ptr %4, align 4, !tbaa !5
  %86 = icmp eq i32 %85, 1
  br i1 %86, label %87, label %101

87:                                               ; preds = %.lr.ph113
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %7) #10
  %88 = load i32, ptr %2, align 4, !tbaa !5
  %89 = sext i32 %88 to i64
  %90 = getelementptr inbounds [100010 x i32], ptr @L, i64 0, i64 %89
  %91 = load i32, ptr %90, align 4, !tbaa !5
  %92 = load i32, ptr %3, align 4, !tbaa !5
  %93 = sext i32 %92 to i64
  %94 = getelementptr inbounds [100010 x i32], ptr @R, i64 0, i64 %93
  %95 = load i32, ptr %94, align 4, !tbaa !5
  %96 = load i32, ptr %5, align 4, !tbaa !5
  %97 = load i32, ptr %6, align 4, !tbaa !5
  call void @_ZN5QUERYC2Eiiiii(ptr noundef nonnull align 4 dereferenceable(24) %7, i32 noundef %91, i32 noundef %95, i32 noundef %96, i32 noundef %97, i32 noundef %.066112)
  %98 = add nsw i32 %.072110, 1
  %99 = sext i32 %.072110 to i64
  %100 = getelementptr inbounds [100010 x %struct.QUERY], ptr @qr1, i64 0, i64 %99
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %100, ptr noundef nonnull align 4 dereferenceable(24) %7, i64 24, i1 false), !tbaa.struct !19
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %7) #10
  br label %109

101:                                              ; preds = %.lr.ph113
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %8) #10
  %102 = load i32, ptr %2, align 4, !tbaa !5
  %103 = load i32, ptr %3, align 4, !tbaa !5
  %104 = load i32, ptr %5, align 4, !tbaa !5
  %105 = load i32, ptr %6, align 4, !tbaa !5
  call void @_ZN5QUERYC2Eiiiii(ptr noundef nonnull align 4 dereferenceable(24) %8, i32 noundef %102, i32 noundef %103, i32 noundef %104, i32 noundef %105, i32 noundef %.066112)
  %106 = add nsw i32 %.071111, 1
  %107 = sext i32 %.071111 to i64
  %108 = getelementptr inbounds [100010 x %struct.QUERY], ptr @qr2, i64 0, i64 %107
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %108, ptr noundef nonnull align 4 dereferenceable(24) %8, i64 24, i1 false), !tbaa.struct !19
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %8) #10
  br label %109

109:                                              ; preds = %87, %101
  %.173 = phi i32 [ %98, %87 ], [ %.072110, %101 ]
  %.1 = phi i32 [ %.071111, %87 ], [ %106, %101 ]
  %110 = add nuw nsw i32 %.066112, 1
  %111 = load i32, ptr @m, align 4, !tbaa !5
  %112 = icmp slt i32 %110, %111
  br i1 %112, label %.lr.ph113, label %._crit_edge114, !llvm.loop !20

..preheader91_crit_edge:                          ; preds = %.lr.ph120, %middle.block227
  %.lcssa221 = phi i64 [ %84, %middle.block227 ], [ %118, %.lr.ph120 ]
  store i64 %.lcssa221, ptr @res, align 16, !tbaa !21
  br label %.preheader91

.preheader91:                                     ; preds = %..preheader91_crit_edge, %._crit_edge114
  %113 = icmp sgt i32 %.072.lcssa, 0
  br i1 %113, label %.preheader90.preheader, label %._crit_edge141

.preheader90.preheader:                           ; preds = %.preheader91
  %wide.trip.count197 = zext nneg i32 %.072.lcssa to i64
  br label %.preheader90

.lr.ph120:                                        ; preds = %.lr.ph120.preheader247, %.lr.ph120
  %indvars.iv179 = phi i64 [ %indvars.iv.next180, %.lr.ph120 ], [ %indvars.iv179.ph, %.lr.ph120.preheader247 ]
  %114 = phi i64 [ %118, %.lr.ph120 ], [ %.ph248, %.lr.ph120.preheader247 ]
  %115 = getelementptr inbounds [100010 x i32], ptr @a, i64 0, i64 %indvars.iv179
  %116 = load i32, ptr %115, align 4, !tbaa !5
  %117 = sext i32 %116 to i64
  %118 = add nsw i64 %114, %117
  %indvars.iv.next180 = add nuw nsw i64 %indvars.iv179, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next180, %wide.trip.count
  br i1 %exitcond.not, label %..preheader91_crit_edge, label %.lr.ph120, !llvm.loop !23

.preheader90:                                     ; preds = %.preheader90.preheader, %._crit_edge136
  %indvars.iv194 = phi i64 [ 0, %.preheader90.preheader ], [ %indvars.iv.next195, %._crit_edge136 ]
  %.074139 = phi i32 [ 0, %.preheader90.preheader ], [ %.2.lcssa, %._crit_edge136 ]
  %.076138 = phi i32 [ 1, %.preheader90.preheader ], [ %.278.lcssa, %._crit_edge136 ]
  %119 = getelementptr inbounds [100010 x %struct.QUERY], ptr @qr1, i64 0, i64 %indvars.iv194
  %120 = getelementptr inbounds i8, ptr %119, i64 4
  %121 = load i32, ptr %120, align 4, !tbaa !24
  %122 = icmp slt i32 %.074139, %121
  br i1 %122, label %.lr.ph124.preheader, label %.preheader89

.lr.ph124.preheader:                              ; preds = %.preheader90
  %123 = sext i32 %.074139 to i64
  br label %.lr.ph124

._crit_edge141:                                   ; preds = %._crit_edge136, %.preheader91
  %124 = sext i32 %.071.lcssa to i64
  %125 = getelementptr inbounds %struct.QUERY, ptr @qr2, i64 %124
  call void @_ZSt4sortIP5QUERYPFbRKS0_S3_EEvT_S6_T0_(ptr noundef nonnull @qr2, ptr noundef nonnull %125, ptr noundef nonnull @_Z4cmpdRK5QUERYS1_)
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(400040) @num, i8 0, i64 400040, i1 false)
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(800080) @res, i8 0, i64 800080, i1 false)
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(100010) @in, i8 0, i64 100010, i1 false)
  %126 = load i32, ptr @n, align 4, !tbaa !5
  %.not87143 = icmp slt i32 %126, 1
  br i1 %.not87143, label %187, label %.lr.ph146.preheader

.lr.ph146.preheader:                              ; preds = %._crit_edge141
  %127 = add nuw i32 %126, 1
  %wide.trip.count202 = zext i32 %127 to i64
  %128 = zext nneg i32 %126 to i64
  %min.iters.check = icmp ult i32 %126, 4
  br i1 %min.iters.check, label %.lr.ph146.preheader246, label %vector.ph

.lr.ph146.preheader246:                           ; preds = %middle.block, %.lr.ph146.preheader
  %indvars.iv199.ph = phi i64 [ 1, %.lr.ph146.preheader ], [ %ind.end, %middle.block ]
  %.ph = phi i64 [ 0, %.lr.ph146.preheader ], [ %136, %middle.block ]
  br label %.lr.ph146

vector.ph:                                        ; preds = %.lr.ph146.preheader
  %n.vec = and i64 %128, 2147483644
  %ind.end = or disjoint i64 %n.vec, 1
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %vec.phi = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %133, %vector.body ]
  %vec.phi225 = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %134, %vector.body ]
  %offset.idx = or disjoint i64 %index, 1
  %129 = getelementptr inbounds [100010 x i32], ptr @a, i64 0, i64 %offset.idx
  %130 = getelementptr inbounds i8, ptr %129, i64 8
  %wide.load = load <2 x i32>, ptr %129, align 4, !tbaa !5
  %wide.load226 = load <2 x i32>, ptr %130, align 4, !tbaa !5
  %131 = sext <2 x i32> %wide.load to <2 x i64>
  %132 = sext <2 x i32> %wide.load226 to <2 x i64>
  %133 = add <2 x i64> %vec.phi, %131
  %134 = add <2 x i64> %vec.phi225, %132
  %index.next = add nuw i64 %index, 4
  %135 = icmp eq i64 %index.next, %n.vec
  br i1 %135, label %middle.block, label %vector.body, !llvm.loop !26

middle.block:                                     ; preds = %vector.body
  %bin.rdx = add <2 x i64> %134, %133
  %136 = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %bin.rdx)
  %cmp.n = icmp eq i64 %n.vec, %128
  br i1 %cmp.n, label %._crit_edge147, label %.lr.ph146.preheader246

.preheader89.loopexit:                            ; preds = %.lr.ph124
  %137 = trunc nsw i64 %indvars.iv.next183 to i32
  br label %.preheader89

.preheader89:                                     ; preds = %.preheader89.loopexit, %.preheader90
  %138 = phi i32 [ %121, %.preheader90 ], [ %144, %.preheader89.loopexit ]
  %.175.lcssa = phi i32 [ %.074139, %.preheader90 ], [ %137, %.preheader89.loopexit ]
  %139 = load i32, ptr %119, align 8, !tbaa !27
  %140 = icmp slt i32 %.076138, %139
  br i1 %140, label %.lr.ph129.preheader, label %.preheader88

.lr.ph129.preheader:                              ; preds = %.preheader89
  %141 = sext i32 %.076138 to i64
  br label %.lr.ph129

.lr.ph124:                                        ; preds = %.lr.ph124.preheader, %.lr.ph124
  %indvars.iv182 = phi i64 [ %123, %.lr.ph124.preheader ], [ %indvars.iv.next183, %.lr.ph124 ]
  %indvars.iv.next183 = add nsw i64 %indvars.iv182, 1
  %142 = getelementptr inbounds [100010 x i32], ptr @is, i64 0, i64 %indvars.iv.next183
  %143 = load i32, ptr %142, align 4, !tbaa !5
  call void @_Z3addi(i32 noundef %143)
  %144 = load i32, ptr %120, align 4, !tbaa !24
  %145 = sext i32 %144 to i64
  %146 = icmp slt i64 %indvars.iv.next183, %145
  br i1 %146, label %.lr.ph124, label %.preheader89.loopexit, !llvm.loop !28

.preheader88.loopexit:                            ; preds = %.lr.ph129
  %147 = trunc nsw i64 %indvars.iv.next186 to i32
  %.pre = load i32, ptr %120, align 4, !tbaa !24
  br label %.preheader88

.preheader88:                                     ; preds = %.preheader88.loopexit, %.preheader89
  %148 = phi i32 [ %139, %.preheader89 ], [ %154, %.preheader88.loopexit ]
  %149 = phi i32 [ %138, %.preheader89 ], [ %.pre, %.preheader88.loopexit ]
  %.177.lcssa = phi i32 [ %.076138, %.preheader89 ], [ %147, %.preheader88.loopexit ]
  %150 = icmp sgt i32 %.175.lcssa, %149
  br i1 %150, label %.lr.ph132.preheader, label %.preheader

.lr.ph132.preheader:                              ; preds = %.preheader88
  %151 = sext i32 %.175.lcssa to i64
  br label %.lr.ph132

.lr.ph129:                                        ; preds = %.lr.ph129.preheader, %.lr.ph129
  %indvars.iv185 = phi i64 [ %141, %.lr.ph129.preheader ], [ %indvars.iv.next186, %.lr.ph129 ]
  %indvars.iv.next186 = add nsw i64 %indvars.iv185, 1
  %152 = getelementptr inbounds [100010 x i32], ptr @is, i64 0, i64 %indvars.iv185
  %153 = load i32, ptr %152, align 4, !tbaa !5
  call void @_Z6removei(i32 noundef %153)
  %154 = load i32, ptr %119, align 8, !tbaa !27
  %155 = sext i32 %154 to i64
  %156 = icmp slt i64 %indvars.iv.next186, %155
  br i1 %156, label %.lr.ph129, label %.preheader88.loopexit, !llvm.loop !29

.preheader.loopexit:                              ; preds = %.lr.ph132
  %157 = trunc nsw i64 %indvars.iv.next189 to i32
  %.pre212 = load i32, ptr %119, align 8, !tbaa !27
  br label %.preheader

.preheader:                                       ; preds = %.preheader.loopexit, %.preheader88
  %158 = phi i32 [ %148, %.preheader88 ], [ %.pre212, %.preheader.loopexit ]
  %.2.lcssa = phi i32 [ %.175.lcssa, %.preheader88 ], [ %157, %.preheader.loopexit ]
  %159 = icmp sgt i32 %.177.lcssa, %158
  br i1 %159, label %.lr.ph135.preheader, label %._crit_edge136

.lr.ph135.preheader:                              ; preds = %.preheader
  %160 = sext i32 %.177.lcssa to i64
  br label %.lr.ph135

.lr.ph132:                                        ; preds = %.lr.ph132.preheader, %.lr.ph132
  %indvars.iv188 = phi i64 [ %151, %.lr.ph132.preheader ], [ %indvars.iv.next189, %.lr.ph132 ]
  %indvars.iv.next189 = add nsw i64 %indvars.iv188, -1
  %161 = getelementptr inbounds [100010 x i32], ptr @is, i64 0, i64 %indvars.iv188
  %162 = load i32, ptr %161, align 4, !tbaa !5
  call void @_Z6removei(i32 noundef %162)
  %163 = load i32, ptr %120, align 4, !tbaa !24
  %164 = sext i32 %163 to i64
  %165 = icmp sgt i64 %indvars.iv.next189, %164
  br i1 %165, label %.lr.ph132, label %.preheader.loopexit, !llvm.loop !30

.lr.ph135:                                        ; preds = %.lr.ph135.preheader, %.lr.ph135
  %indvars.iv191 = phi i64 [ %160, %.lr.ph135.preheader ], [ %indvars.iv.next192, %.lr.ph135 ]
  %indvars.iv.next192 = add nsw i64 %indvars.iv191, -1
  %166 = getelementptr inbounds [100010 x i32], ptr @is, i64 0, i64 %indvars.iv.next192
  %167 = load i32, ptr %166, align 4, !tbaa !5
  call void @_Z3addi(i32 noundef %167)
  %168 = load i32, ptr %119, align 8, !tbaa !27
  %169 = sext i32 %168 to i64
  %170 = icmp sgt i64 %indvars.iv.next192, %169
  br i1 %170, label %.lr.ph135, label %._crit_edge136.loopexit, !llvm.loop !31

._crit_edge136.loopexit:                          ; preds = %.lr.ph135
  %171 = trunc nsw i64 %indvars.iv.next192 to i32
  br label %._crit_edge136

._crit_edge136:                                   ; preds = %._crit_edge136.loopexit, %.preheader
  %.278.lcssa = phi i32 [ %.177.lcssa, %.preheader ], [ %171, %._crit_edge136.loopexit ]
  %172 = getelementptr inbounds i8, ptr %119, i64 12
  %173 = load i32, ptr %172, align 4, !tbaa !32
  %174 = sext i32 %173 to i64
  %175 = getelementptr inbounds [100010 x i64], ptr @res, i64 0, i64 %174
  %176 = load i64, ptr %175, align 8, !tbaa !21
  %177 = getelementptr inbounds i8, ptr %119, i64 16
  %178 = load i32, ptr %177, align 8, !tbaa !33
  %179 = sext i32 %178 to i64
  %180 = getelementptr inbounds [100010 x i64], ptr @res, i64 0, i64 %179
  %181 = load i64, ptr %180, align 8, !tbaa !21
  %182 = call noundef i64 @_ZSt5__gcdIxET_S0_S0_(i64 noundef %176, i64 noundef %181)
  %183 = getelementptr inbounds i8, ptr %119, i64 20
  %184 = load i32, ptr %183, align 4, !tbaa !34
  %185 = sext i32 %184 to i64
  %186 = getelementptr inbounds [100010 x i64], ptr @ans, i64 0, i64 %185
  store i64 %182, ptr %186, align 8, !tbaa !21
  %indvars.iv.next195 = add nuw nsw i64 %indvars.iv194, 1
  %exitcond198.not = icmp eq i64 %indvars.iv.next195, %wide.trip.count197
  br i1 %exitcond198.not, label %._crit_edge141, label %.preheader90, !llvm.loop !35

._crit_edge147:                                   ; preds = %.lr.ph146, %middle.block
  %.lcssa224 = phi i64 [ %136, %middle.block ], [ %193, %.lr.ph146 ]
  store i64 %.lcssa224, ptr @res, align 16, !tbaa !21
  br label %187

187:                                              ; preds = %._crit_edge147, %._crit_edge141
  call void @_Z3addi(i32 noundef 1)
  store i8 1, ptr getelementptr inbounds (i8, ptr @in, i64 1), align 1, !tbaa !36
  %188 = icmp sgt i32 %.071.lcssa, 0
  br i1 %188, label %.lr.ph153.preheader, label %._crit_edge154

.lr.ph153.preheader:                              ; preds = %187
  %wide.trip.count207 = zext nneg i32 %.071.lcssa to i64
  br label %.lr.ph153

.lr.ph146:                                        ; preds = %.lr.ph146.preheader246, %.lr.ph146
  %indvars.iv199 = phi i64 [ %indvars.iv.next200, %.lr.ph146 ], [ %indvars.iv199.ph, %.lr.ph146.preheader246 ]
  %189 = phi i64 [ %193, %.lr.ph146 ], [ %.ph, %.lr.ph146.preheader246 ]
  %190 = getelementptr inbounds [100010 x i32], ptr @a, i64 0, i64 %indvars.iv199
  %191 = load i32, ptr %190, align 4, !tbaa !5
  %192 = sext i32 %191 to i64
  %193 = add nsw i64 %189, %192
  %indvars.iv.next200 = add nuw nsw i64 %indvars.iv199, 1
  %exitcond203.not = icmp eq i64 %indvars.iv.next200, %wide.trip.count202
  br i1 %exitcond203.not, label %._crit_edge147, label %.lr.ph146, !llvm.loop !38

._crit_edge154:                                   ; preds = %.lr.ph153, %187
  %194 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %.070160)
  %195 = load i32, ptr @m, align 4, !tbaa !5
  %196 = icmp sgt i32 %195, 0
  br i1 %196, label %.lr.ph157, label %._crit_edge158

.lr.ph153:                                        ; preds = %.lr.ph153.preheader, %.lr.ph153
  %indvars.iv204 = phi i64 [ 0, %.lr.ph153.preheader ], [ %indvars.iv.next205, %.lr.ph153 ]
  %.3150 = phi i32 [ 1, %.lr.ph153.preheader ], [ %202, %.lr.ph153 ]
  %.379149 = phi i32 [ 1, %.lr.ph153.preheader ], [ %201, %.lr.ph153 ]
  %197 = getelementptr inbounds [100010 x %struct.QUERY], ptr @qr2, i64 0, i64 %indvars.iv204
  %198 = load i32, ptr %197, align 8, !tbaa !27
  call void @_Z4moveii(i32 noundef %.379149, i32 noundef %198)
  %199 = getelementptr inbounds i8, ptr %197, i64 4
  %200 = load i32, ptr %199, align 4, !tbaa !24
  call void @_Z4moveii(i32 noundef %.3150, i32 noundef %200)
  %201 = load i32, ptr %197, align 8, !tbaa !27
  %202 = load i32, ptr %199, align 4, !tbaa !24
  %203 = getelementptr inbounds i8, ptr %197, i64 12
  %204 = load i32, ptr %203, align 4, !tbaa !32
  %205 = sext i32 %204 to i64
  %206 = getelementptr inbounds [100010 x i64], ptr @res, i64 0, i64 %205
  %207 = load i64, ptr %206, align 8, !tbaa !21
  %208 = getelementptr inbounds i8, ptr %197, i64 16
  %209 = load i32, ptr %208, align 8, !tbaa !33
  %210 = sext i32 %209 to i64
  %211 = getelementptr inbounds [100010 x i64], ptr @res, i64 0, i64 %210
  %212 = load i64, ptr %211, align 8, !tbaa !21
  %213 = call noundef i64 @_ZSt5__gcdIxET_S0_S0_(i64 noundef %207, i64 noundef %212)
  %214 = getelementptr inbounds i8, ptr %197, i64 20
  %215 = load i32, ptr %214, align 4, !tbaa !34
  %216 = sext i32 %215 to i64
  %217 = getelementptr inbounds [100010 x i64], ptr @ans, i64 0, i64 %216
  store i64 %213, ptr %217, align 8, !tbaa !21
  %indvars.iv.next205 = add nuw nsw i64 %indvars.iv204, 1
  %exitcond208.not = icmp eq i64 %indvars.iv.next205, %wide.trip.count207
  br i1 %exitcond208.not, label %._crit_edge154, label %.lr.ph153, !llvm.loop !39

._crit_edge158:                                   ; preds = %.lr.ph157, %._crit_edge154
  %218 = add nuw nsw i32 %.070160, 1
  %219 = load i32, ptr %1, align 4, !tbaa !5
  %.not.not = icmp slt i32 %.070160, %219
  br i1 %.not.not, label %.lr.ph162, label %._crit_edge163, !llvm.loop !40

.lr.ph157:                                        ; preds = %._crit_edge154, %.lr.ph157
  %indvars.iv209 = phi i64 [ %indvars.iv.next210, %.lr.ph157 ], [ 0, %._crit_edge154 ]
  %220 = getelementptr inbounds [100010 x i64], ptr @ans, i64 0, i64 %indvars.iv209
  %221 = load i64, ptr %220, align 8, !tbaa !21
  call void @_Z5printx(i64 noundef %221)
  %222 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.4)
  %indvars.iv.next210 = add nuw nsw i64 %indvars.iv209, 1
  %223 = load i32, ptr @m, align 4, !tbaa !5
  %224 = sext i32 %223 to i64
  %225 = icmp slt i64 %indvars.iv.next210, %224
  br i1 %225, label %.lr.ph157, label %._crit_edge158, !llvm.loop !41
}

; 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: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #5

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_Z3addii(i32 noundef, i32 noundef) local_unnamed_addr #7

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_Z3addi(i32 noundef) local_unnamed_addr #7

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_Z6removei(i32 noundef) local_unnamed_addr #7

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

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

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

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.vector.reduce.add.v2i64(<2 x i64>) #9

attributes #0 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { 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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { 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 #7 = { 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 #8 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #9 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #10 = { 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, !13}
!13 = !{!"llvm.loop.unroll.disable"}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10, !17, !18}
!17 = !{!"llvm.loop.isvectorized", i32 1}
!18 = !{!"llvm.loop.unroll.runtime.disable"}
!19 = !{i64 0, i64 4, !5, i64 4, i64 4, !5, i64 8, i64 4, !5, i64 12, i64 4, !5, i64 16, i64 4, !5, i64 20, i64 4, !5}
!20 = distinct !{!20, !10}
!21 = !{!22, !22, i64 0}
!22 = !{!"long long", !7, i64 0}
!23 = distinct !{!23, !10, !18, !17}
!24 = !{!25, !6, i64 4}
!25 = !{!"_ZTS5QUERY", !6, i64 0, !6, i64 4, !6, i64 8, !6, i64 12, !6, i64 16, !6, i64 20}
!26 = distinct !{!26, !10, !17, !18}
!27 = !{!25, !6, i64 0}
!28 = distinct !{!28, !10}
!29 = distinct !{!29, !10}
!30 = distinct !{!30, !10}
!31 = distinct !{!31, !10}
!32 = !{!25, !6, i64 12}
!33 = !{!25, !6, i64 16}
!34 = !{!25, !6, i64 20}
!35 = distinct !{!35, !10}
!36 = !{!37, !37, i64 0}
!37 = !{!"bool", !7, i64 0}
!38 = distinct !{!38, !10, !18, !17}
!39 = distinct !{!39, !10}
!40 = distinct !{!40, !10}
!41 = distinct !{!41, !10}


; Effective O3 passes: BDCEPass,CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopInstSimplifyPass,LoopLoadEliminationPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,LoopVectorizePass,SROAPass,SimplifyCFGPass