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

; 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.Point = type { i32, i32 }
%struct.Query = type { i32, i32, i32, i32, i32 }

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@k = external dso_local global i32, align 4
@q = external dso_local global i32, align 4
@seg = external dso_local global [262145 x i32], align 16
@ans = external dso_local global [200001 x i8], align 16
@rook = external dso_local global [200001 x %struct.Point], align 16
@query = external dso_local global [200001 x %struct.Query], align 16
@.str = external hidden unnamed_addr constant [9 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [3 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z3updiiiii(i32 noundef, i32 noundef, i32 noundef, 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 uwtable
declare dso_local noundef i32 @_Z3queiiiii(i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef) #0

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #2 {
  %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
  store i32 0, ptr %1, align 4
  %11 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n, ptr noundef @m, ptr noundef @k, ptr noundef @q)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #7
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %12

12:                                               ; preds = %27, %0
  %13 = load i32, ptr %2, align 4, !tbaa !5
  %14 = load i32, ptr @k, align 4, !tbaa !5
  %15 = icmp slt i32 %13, %14
  br i1 %15, label %17, label %16

16:                                               ; preds = %12
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #7
  br label %30

17:                                               ; preds = %12
  %18 = load i32, ptr %2, align 4, !tbaa !5
  %19 = sext i32 %18 to i64
  %20 = getelementptr inbounds [200001 x %struct.Point], ptr @rook, i64 0, i64 %19
  %21 = getelementptr inbounds %struct.Point, ptr %20, i32 0, i32 0
  %22 = load i32, ptr %2, align 4, !tbaa !5
  %23 = sext i32 %22 to i64
  %24 = getelementptr inbounds [200001 x %struct.Point], ptr @rook, i64 0, i64 %23
  %25 = getelementptr inbounds %struct.Point, ptr %24, i32 0, i32 1
  %26 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %21, ptr noundef %25)
  br label %27

27:                                               ; preds = %17
  %28 = load i32, ptr %2, align 4, !tbaa !5
  %29 = add nsw i32 %28, 1
  store i32 %29, ptr %2, align 4, !tbaa !5
  br label %12, !llvm.loop !9

30:                                               ; preds = %16
  %31 = load i32, ptr @k, align 4, !tbaa !5
  %32 = sext i32 %31 to i64
  %33 = getelementptr inbounds %struct.Point, ptr @rook, i64 %32
  call void @_ZSt4sortIP5PointEvT_S2_(ptr noundef @rook, ptr noundef %33)
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #7
  store i32 0, ptr %3, align 4, !tbaa !5
  br label %34

34:                                               ; preds = %62, %30
  %35 = load i32, ptr %3, align 4, !tbaa !5
  %36 = load i32, ptr @q, align 4, !tbaa !5
  %37 = icmp slt i32 %35, %36
  br i1 %37, label %39, label %38

38:                                               ; preds = %34
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #7
  br label %65

39:                                               ; preds = %34
  %40 = load i32, ptr %3, align 4, !tbaa !5
  %41 = load i32, ptr %3, align 4, !tbaa !5
  %42 = sext i32 %41 to i64
  %43 = getelementptr inbounds [200001 x %struct.Query], ptr @query, i64 0, i64 %42
  %44 = getelementptr inbounds %struct.Query, ptr %43, i32 0, i32 0
  store i32 %40, ptr %44, align 4, !tbaa !11
  %45 = load i32, ptr %3, align 4, !tbaa !5
  %46 = sext i32 %45 to i64
  %47 = getelementptr inbounds [200001 x %struct.Query], ptr @query, i64 0, i64 %46
  %48 = getelementptr inbounds %struct.Query, ptr %47, i32 0, i32 1
  %49 = load i32, ptr %3, align 4, !tbaa !5
  %50 = sext i32 %49 to i64
  %51 = getelementptr inbounds [200001 x %struct.Query], ptr @query, i64 0, i64 %50
  %52 = getelementptr inbounds %struct.Query, ptr %51, i32 0, i32 2
  %53 = load i32, ptr %3, align 4, !tbaa !5
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds [200001 x %struct.Query], ptr @query, i64 0, i64 %54
  %56 = getelementptr inbounds %struct.Query, ptr %55, i32 0, i32 3
  %57 = load i32, ptr %3, align 4, !tbaa !5
  %58 = sext i32 %57 to i64
  %59 = getelementptr inbounds [200001 x %struct.Query], ptr @query, i64 0, i64 %58
  %60 = getelementptr inbounds %struct.Query, ptr %59, i32 0, i32 4
  %61 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %48, ptr noundef %52, ptr noundef %56, ptr noundef %60)
  br label %62

62:                                               ; preds = %39
  %63 = load i32, ptr %3, align 4, !tbaa !5
  %64 = add nsw i32 %63, 1
  store i32 %64, ptr %3, align 4, !tbaa !5
  br label %34, !llvm.loop !13

65:                                               ; preds = %38
  %66 = load i32, ptr @q, align 4, !tbaa !5
  %67 = sext i32 %66 to i64
  %68 = getelementptr inbounds %struct.Query, ptr @query, i64 %67
  call void @_ZSt4sortIP5QueryEvT_S2_(ptr noundef @query, ptr noundef %68)
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #7
  store i32 0, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #7
  store i32 0, ptr %5, align 4, !tbaa !5
  br label %69

69:                                               ; preds = %140, %65
  %70 = load i32, ptr %4, align 4, !tbaa !5
  %71 = load i32, ptr @q, align 4, !tbaa !5
  %72 = icmp slt i32 %70, %71
  br i1 %72, label %74, label %73

73:                                               ; preds = %69
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #7
  br label %143

74:                                               ; preds = %69
  br label %75

75:                                               ; preds = %93, %74
  %76 = load i32, ptr %5, align 4, !tbaa !5
  %77 = load i32, ptr @k, align 4, !tbaa !5
  %78 = icmp slt i32 %76, %77
  br i1 %78, label %79, label %91

79:                                               ; preds = %75
  %80 = load i32, ptr %5, align 4, !tbaa !5
  %81 = sext i32 %80 to i64
  %82 = getelementptr inbounds [200001 x %struct.Point], ptr @rook, i64 0, i64 %81
  %83 = getelementptr inbounds %struct.Point, ptr %82, i32 0, i32 0
  %84 = load i32, ptr %83, align 8, !tbaa !14
  %85 = load i32, ptr %4, align 4, !tbaa !5
  %86 = sext i32 %85 to i64
  %87 = getelementptr inbounds [200001 x %struct.Query], ptr @query, i64 0, i64 %86
  %88 = getelementptr inbounds %struct.Query, ptr %87, i32 0, i32 3
  %89 = load i32, ptr %88, align 4, !tbaa !16
  %90 = icmp sle i32 %84, %89
  br label %91

91:                                               ; preds = %79, %75
  %92 = phi i1 [ false, %75 ], [ %90, %79 ]
  br i1 %92, label %93, label %107

93:                                               ; preds = %91
  %94 = load i32, ptr @m, align 4, !tbaa !5
  %95 = load i32, ptr %5, align 4, !tbaa !5
  %96 = sext i32 %95 to i64
  %97 = getelementptr inbounds [200001 x %struct.Point], ptr @rook, i64 0, i64 %96
  %98 = getelementptr inbounds %struct.Point, ptr %97, i32 0, i32 1
  %99 = load i32, ptr %98, align 4, !tbaa !17
  %100 = load i32, ptr %5, align 4, !tbaa !5
  %101 = sext i32 %100 to i64
  %102 = getelementptr inbounds [200001 x %struct.Point], ptr @rook, i64 0, i64 %101
  %103 = getelementptr inbounds %struct.Point, ptr %102, i32 0, i32 0
  %104 = load i32, ptr %103, align 8, !tbaa !14
  call void @_Z3updiiiii(i32 noundef 1, i32 noundef 1, i32 noundef %94, i32 noundef %99, i32 noundef %104)
  %105 = load i32, ptr %5, align 4, !tbaa !5
  %106 = add nsw i32 %105, 1
  store i32 %106, ptr %5, align 4, !tbaa !5
  br label %75, !llvm.loop !18

107:                                              ; preds = %91
  %108 = load i32, ptr @m, align 4, !tbaa !5
  %109 = load i32, ptr %4, align 4, !tbaa !5
  %110 = sext i32 %109 to i64
  %111 = getelementptr inbounds [200001 x %struct.Query], ptr @query, i64 0, i64 %110
  %112 = getelementptr inbounds %struct.Query, ptr %111, i32 0, i32 2
  %113 = load i32, ptr %112, align 4, !tbaa !19
  %114 = load i32, ptr %4, align 4, !tbaa !5
  %115 = sext i32 %114 to i64
  %116 = getelementptr inbounds [200001 x %struct.Query], ptr @query, i64 0, i64 %115
  %117 = getelementptr inbounds %struct.Query, ptr %116, i32 0, i32 4
  %118 = load i32, ptr %117, align 4, !tbaa !20
  %119 = call noundef i32 @_Z3queiiiii(i32 noundef 1, i32 noundef 1, i32 noundef %108, i32 noundef %113, i32 noundef %118)
  %120 = load i32, ptr %4, align 4, !tbaa !5
  %121 = sext i32 %120 to i64
  %122 = getelementptr inbounds [200001 x %struct.Query], ptr @query, i64 0, i64 %121
  %123 = getelementptr inbounds %struct.Query, ptr %122, i32 0, i32 1
  %124 = load i32, ptr %123, align 4, !tbaa !21
  %125 = icmp sge i32 %119, %124
  %126 = zext i1 %125 to i32
  %127 = load i32, ptr %4, align 4, !tbaa !5
  %128 = sext i32 %127 to i64
  %129 = getelementptr inbounds [200001 x %struct.Query], ptr @query, i64 0, i64 %128
  %130 = getelementptr inbounds %struct.Query, ptr %129, i32 0, i32 0
  %131 = load i32, ptr %130, align 4, !tbaa !11
  %132 = sext i32 %131 to i64
  %133 = getelementptr inbounds [200001 x i8], ptr @ans, i64 0, i64 %132
  %134 = load i8, ptr %133, align 1, !tbaa !22, !range !24, !noundef !25
  %135 = trunc i8 %134 to i1
  %136 = zext i1 %135 to i32
  %137 = or i32 %136, %126
  %138 = icmp ne i32 %137, 0
  %139 = zext i1 %138 to i8
  store i8 %139, ptr %133, align 1, !tbaa !22
  br label %140

140:                                              ; preds = %107
  %141 = load i32, ptr %4, align 4, !tbaa !5
  %142 = add nsw i32 %141, 1
  store i32 %142, ptr %4, align 4, !tbaa !5
  br label %69, !llvm.loop !26

143:                                              ; preds = %73
  call void @llvm.memset.p0.i64(ptr align 16 @seg, i8 0, i64 1048580, i1 false)
  call void @_ZSt4swapIiENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 4 dereferenceable(4) @n, ptr noundef nonnull align 4 dereferenceable(4) @m) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #7
  store i32 0, ptr %6, align 4, !tbaa !5
  br label %144

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

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

149:                                              ; preds = %144
  %150 = load i32, ptr %6, align 4, !tbaa !5
  %151 = sext i32 %150 to i64
  %152 = getelementptr inbounds [200001 x %struct.Point], ptr @rook, i64 0, i64 %151
  %153 = getelementptr inbounds %struct.Point, ptr %152, i32 0, i32 0
  %154 = load i32, ptr %6, align 4, !tbaa !5
  %155 = sext i32 %154 to i64
  %156 = getelementptr inbounds [200001 x %struct.Point], ptr @rook, i64 0, i64 %155
  %157 = getelementptr inbounds %struct.Point, ptr %156, i32 0, i32 1
  call void @_ZSt4swapIiENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 4 dereferenceable(4) %153, ptr noundef nonnull align 4 dereferenceable(4) %157) #7
  br label %158

158:                                              ; preds = %149
  %159 = load i32, ptr %6, align 4, !tbaa !5
  %160 = add nsw i32 %159, 1
  store i32 %160, ptr %6, align 4, !tbaa !5
  br label %144, !llvm.loop !27

161:                                              ; preds = %148
  %162 = load i32, ptr @k, align 4, !tbaa !5
  %163 = sext i32 %162 to i64
  %164 = getelementptr inbounds %struct.Point, ptr @rook, i64 %163
  call void @_ZSt4sortIP5PointEvT_S2_(ptr noundef @rook, ptr noundef %164)
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #7
  store i32 0, ptr %7, align 4, !tbaa !5
  br label %165

165:                                              ; preds = %187, %161
  %166 = load i32, ptr %7, align 4, !tbaa !5
  %167 = load i32, ptr @q, align 4, !tbaa !5
  %168 = icmp slt i32 %166, %167
  br i1 %168, label %170, label %169

169:                                              ; preds = %165
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #7
  br label %190

170:                                              ; preds = %165
  %171 = load i32, ptr %7, align 4, !tbaa !5
  %172 = sext i32 %171 to i64
  %173 = getelementptr inbounds [200001 x %struct.Query], ptr @query, i64 0, i64 %172
  %174 = getelementptr inbounds %struct.Query, ptr %173, i32 0, i32 1
  %175 = load i32, ptr %7, align 4, !tbaa !5
  %176 = sext i32 %175 to i64
  %177 = getelementptr inbounds [200001 x %struct.Query], ptr @query, i64 0, i64 %176
  %178 = getelementptr inbounds %struct.Query, ptr %177, i32 0, i32 2
  call void @_ZSt4swapIiENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 4 dereferenceable(4) %174, ptr noundef nonnull align 4 dereferenceable(4) %178) #7
  %179 = load i32, ptr %7, align 4, !tbaa !5
  %180 = sext i32 %179 to i64
  %181 = getelementptr inbounds [200001 x %struct.Query], ptr @query, i64 0, i64 %180
  %182 = getelementptr inbounds %struct.Query, ptr %181, i32 0, i32 3
  %183 = load i32, ptr %7, align 4, !tbaa !5
  %184 = sext i32 %183 to i64
  %185 = getelementptr inbounds [200001 x %struct.Query], ptr @query, i64 0, i64 %184
  %186 = getelementptr inbounds %struct.Query, ptr %185, i32 0, i32 4
  call void @_ZSt4swapIiENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 4 dereferenceable(4) %182, ptr noundef nonnull align 4 dereferenceable(4) %186) #7
  br label %187

187:                                              ; preds = %170
  %188 = load i32, ptr %7, align 4, !tbaa !5
  %189 = add nsw i32 %188, 1
  store i32 %189, ptr %7, align 4, !tbaa !5
  br label %165, !llvm.loop !28

190:                                              ; preds = %169
  %191 = load i32, ptr @q, align 4, !tbaa !5
  %192 = sext i32 %191 to i64
  %193 = getelementptr inbounds %struct.Query, ptr @query, i64 %192
  call void @_ZSt4sortIP5QueryEvT_S2_(ptr noundef @query, ptr noundef %193)
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #7
  store i32 0, ptr %8, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #7
  store i32 0, ptr %9, align 4, !tbaa !5
  br label %194

194:                                              ; preds = %265, %190
  %195 = load i32, ptr %8, align 4, !tbaa !5
  %196 = load i32, ptr @q, align 4, !tbaa !5
  %197 = icmp slt i32 %195, %196
  br i1 %197, label %199, label %198

198:                                              ; preds = %194
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #7
  br label %268

199:                                              ; preds = %194
  br label %200

200:                                              ; preds = %218, %199
  %201 = load i32, ptr %9, align 4, !tbaa !5
  %202 = load i32, ptr @k, align 4, !tbaa !5
  %203 = icmp slt i32 %201, %202
  br i1 %203, label %204, label %216

204:                                              ; preds = %200
  %205 = load i32, ptr %9, align 4, !tbaa !5
  %206 = sext i32 %205 to i64
  %207 = getelementptr inbounds [200001 x %struct.Point], ptr @rook, i64 0, i64 %206
  %208 = getelementptr inbounds %struct.Point, ptr %207, i32 0, i32 0
  %209 = load i32, ptr %208, align 8, !tbaa !14
  %210 = load i32, ptr %8, align 4, !tbaa !5
  %211 = sext i32 %210 to i64
  %212 = getelementptr inbounds [200001 x %struct.Query], ptr @query, i64 0, i64 %211
  %213 = getelementptr inbounds %struct.Query, ptr %212, i32 0, i32 3
  %214 = load i32, ptr %213, align 4, !tbaa !16
  %215 = icmp sle i32 %209, %214
  br label %216

216:                                              ; preds = %204, %200
  %217 = phi i1 [ false, %200 ], [ %215, %204 ]
  br i1 %217, label %218, label %232

218:                                              ; preds = %216
  %219 = load i32, ptr @m, align 4, !tbaa !5
  %220 = load i32, ptr %9, align 4, !tbaa !5
  %221 = sext i32 %220 to i64
  %222 = getelementptr inbounds [200001 x %struct.Point], ptr @rook, i64 0, i64 %221
  %223 = getelementptr inbounds %struct.Point, ptr %222, i32 0, i32 1
  %224 = load i32, ptr %223, align 4, !tbaa !17
  %225 = load i32, ptr %9, align 4, !tbaa !5
  %226 = sext i32 %225 to i64
  %227 = getelementptr inbounds [200001 x %struct.Point], ptr @rook, i64 0, i64 %226
  %228 = getelementptr inbounds %struct.Point, ptr %227, i32 0, i32 0
  %229 = load i32, ptr %228, align 8, !tbaa !14
  call void @_Z3updiiiii(i32 noundef 1, i32 noundef 1, i32 noundef %219, i32 noundef %224, i32 noundef %229)
  %230 = load i32, ptr %9, align 4, !tbaa !5
  %231 = add nsw i32 %230, 1
  store i32 %231, ptr %9, align 4, !tbaa !5
  br label %200, !llvm.loop !29

232:                                              ; preds = %216
  %233 = load i32, ptr @m, align 4, !tbaa !5
  %234 = load i32, ptr %8, align 4, !tbaa !5
  %235 = sext i32 %234 to i64
  %236 = getelementptr inbounds [200001 x %struct.Query], ptr @query, i64 0, i64 %235
  %237 = getelementptr inbounds %struct.Query, ptr %236, i32 0, i32 2
  %238 = load i32, ptr %237, align 4, !tbaa !19
  %239 = load i32, ptr %8, align 4, !tbaa !5
  %240 = sext i32 %239 to i64
  %241 = getelementptr inbounds [200001 x %struct.Query], ptr @query, i64 0, i64 %240
  %242 = getelementptr inbounds %struct.Query, ptr %241, i32 0, i32 4
  %243 = load i32, ptr %242, align 4, !tbaa !20
  %244 = call noundef i32 @_Z3queiiiii(i32 noundef 1, i32 noundef 1, i32 noundef %233, i32 noundef %238, i32 noundef %243)
  %245 = load i32, ptr %8, align 4, !tbaa !5
  %246 = sext i32 %245 to i64
  %247 = getelementptr inbounds [200001 x %struct.Query], ptr @query, i64 0, i64 %246
  %248 = getelementptr inbounds %struct.Query, ptr %247, i32 0, i32 1
  %249 = load i32, ptr %248, align 4, !tbaa !21
  %250 = icmp sge i32 %244, %249
  %251 = zext i1 %250 to i32
  %252 = load i32, ptr %8, align 4, !tbaa !5
  %253 = sext i32 %252 to i64
  %254 = getelementptr inbounds [200001 x %struct.Query], ptr @query, i64 0, i64 %253
  %255 = getelementptr inbounds %struct.Query, ptr %254, i32 0, i32 0
  %256 = load i32, ptr %255, align 4, !tbaa !11
  %257 = sext i32 %256 to i64
  %258 = getelementptr inbounds [200001 x i8], ptr @ans, i64 0, i64 %257
  %259 = load i8, ptr %258, align 1, !tbaa !22, !range !24, !noundef !25
  %260 = trunc i8 %259 to i1
  %261 = zext i1 %260 to i32
  %262 = or i32 %261, %251
  %263 = icmp ne i32 %262, 0
  %264 = zext i1 %263 to i8
  store i8 %264, ptr %258, align 1, !tbaa !22
  br label %265

265:                                              ; preds = %232
  %266 = load i32, ptr %8, align 4, !tbaa !5
  %267 = add nsw i32 %266, 1
  store i32 %267, ptr %8, align 4, !tbaa !5
  br label %194, !llvm.loop !30

268:                                              ; preds = %198
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #7
  store i32 0, ptr %10, align 4, !tbaa !5
  br label %269

269:                                              ; preds = %283, %268
  %270 = load i32, ptr %10, align 4, !tbaa !5
  %271 = load i32, ptr @q, align 4, !tbaa !5
  %272 = icmp slt i32 %270, %271
  br i1 %272, label %274, label %273

273:                                              ; preds = %269
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #7
  br label %286

274:                                              ; preds = %269
  %275 = load i32, ptr %10, align 4, !tbaa !5
  %276 = sext i32 %275 to i64
  %277 = getelementptr inbounds [200001 x i8], ptr @ans, i64 0, i64 %276
  %278 = load i8, ptr %277, align 1, !tbaa !22, !range !24, !noundef !25
  %279 = trunc i8 %278 to i1
  %280 = zext i1 %279 to i64
  %281 = select i1 %279, ptr @.str.2, ptr @.str.3
  %282 = call i32 @puts(ptr noundef %281)
  br label %283

283:                                              ; preds = %274
  %284 = load i32, ptr %10, align 4, !tbaa !5
  %285 = add nsw i32 %284, 1
  store i32 %285, ptr %10, align 4, !tbaa !5
  br label %269, !llvm.loop !31

286:                                              ; preds = %273
  ret i32 0
}

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIP5QueryEvT_S2_(ptr noundef, 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 nounwind uwtable
declare dso_local void @_ZSt4swapIiENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #6

declare i32 @puts(ptr noundef) #3

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 norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { inlinehint mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!12, !6, i64 0}
!12 = !{!"_ZTS5Query", !6, i64 0, !6, i64 4, !6, i64 8, !6, i64 12, !6, i64 16}
!13 = distinct !{!13, !10}
!14 = !{!15, !6, i64 0}
!15 = !{!"_ZTS5Point", !6, i64 0, !6, i64 4}
!16 = !{!12, !6, i64 12}
!17 = !{!15, !6, i64 4}
!18 = distinct !{!18, !10}
!19 = !{!12, !6, i64 8}
!20 = !{!12, !6, i64 16}
!21 = !{!12, !6, i64 4}
!22 = !{!23, !23, i64 0}
!23 = !{!"bool", !7, i64 0}
!24 = !{i8 0, i8 2}
!25 = !{}
!26 = distinct !{!26, !10}
!27 = distinct !{!27, !10}
!28 = distinct !{!28, !10}
!29 = distinct !{!29, !10}
!30 = distinct !{!30, !10}
!31 = distinct !{!31, !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.Point = type { i32, i32 }
%struct.Query = type { i32, i32, i32, i32, i32 }

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@k = external dso_local global i32, align 4
@q = external dso_local global i32, align 4
@seg = external dso_local local_unnamed_addr global [262145 x i32], align 16
@ans = external dso_local local_unnamed_addr global [200001 x i8], align 16
@rook = external dso_local global [200001 x %struct.Point], align 16
@query = external dso_local global [200001 x %struct.Query], align 16
@.str = external hidden unnamed_addr constant [9 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [3 x i8], align 1

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #1 {
  %1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull @m, ptr noundef nonnull @k, ptr noundef nonnull @q)
  %2 = load i32, ptr @k, align 4, !tbaa !5
  %3 = icmp sgt i32 %2, 0
  br i1 %3, label %.lr.ph, label %.._crit_edge_crit_edge

.._crit_edge_crit_edge:                           ; preds = %0
  %.pre = sext i32 %2 to i64
  br label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %.._crit_edge_crit_edge
  %.pre-phi = phi i64 [ %.pre, %.._crit_edge_crit_edge ], [ %11, %.lr.ph ]
  %4 = getelementptr inbounds %struct.Point, ptr @rook, i64 %.pre-phi
  tail call void @_ZSt4sortIP5PointEvT_S2_(ptr noundef nonnull @rook, ptr noundef nonnull %4)
  %5 = load i32, ptr @q, align 4, !tbaa !5
  %6 = icmp sgt i32 %5, 0
  br i1 %6, label %.lr.ph75, label %._crit_edge.._crit_edge76_crit_edge

._crit_edge.._crit_edge76_crit_edge:              ; preds = %._crit_edge
  %.pre141 = sext i32 %5 to i64
  br label %._crit_edge76

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %0 ]
  %7 = getelementptr inbounds [200001 x %struct.Point], ptr @rook, i64 0, i64 %indvars.iv
  %8 = getelementptr inbounds i8, ptr %7, i64 4
  %9 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %7, ptr noundef nonnull %8)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %10 = load i32, ptr @k, align 4, !tbaa !5
  %11 = sext i32 %10 to i64
  %12 = icmp slt i64 %indvars.iv.next, %11
  br i1 %12, label %.lr.ph, label %._crit_edge, !llvm.loop !9

._crit_edge76:                                    ; preds = %.lr.ph75, %._crit_edge.._crit_edge76_crit_edge
  %.pre-phi142 = phi i64 [ %.pre141, %._crit_edge.._crit_edge76_crit_edge ], [ %24, %.lr.ph75 ]
  %13 = getelementptr inbounds %struct.Query, ptr @query, i64 %.pre-phi142
  tail call void @_ZSt4sortIP5QueryEvT_S2_(ptr noundef nonnull @query, ptr noundef nonnull %13)
  %14 = load i32, ptr @q, align 4, !tbaa !5
  %15 = icmp sgt i32 %14, 0
  br i1 %15, label %.preheader68, label %._crit_edge85

.lr.ph75:                                         ; preds = %._crit_edge, %.lr.ph75
  %indvars.iv111 = phi i64 [ %indvars.iv.next112, %.lr.ph75 ], [ 0, %._crit_edge ]
  %16 = getelementptr inbounds [200001 x %struct.Query], ptr @query, i64 0, i64 %indvars.iv111
  %17 = trunc nuw nsw i64 %indvars.iv111 to i32
  store i32 %17, ptr %16, align 4, !tbaa !11
  %18 = getelementptr inbounds i8, ptr %16, i64 4
  %19 = getelementptr inbounds i8, ptr %16, i64 8
  %20 = getelementptr inbounds i8, ptr %16, i64 12
  %21 = getelementptr inbounds i8, ptr %16, i64 16
  %22 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %18, ptr noundef nonnull %19, ptr noundef nonnull %20, ptr noundef nonnull %21)
  %indvars.iv.next112 = add nuw nsw i64 %indvars.iv111, 1
  %23 = load i32, ptr @q, align 4, !tbaa !5
  %24 = sext i32 %23 to i64
  %25 = icmp slt i64 %indvars.iv.next112, %24
  br i1 %25, label %.lr.ph75, label %._crit_edge76, !llvm.loop !13

.preheader68:                                     ; preds = %._crit_edge76, %.critedge
  %indvars.iv117 = phi i64 [ %indvars.iv.next118, %.critedge ], [ 0, %._crit_edge76 ]
  %.05584 = phi i32 [ %.156.lcssa, %.critedge ], [ 0, %._crit_edge76 ]
  %26 = load i32, ptr @k, align 4, !tbaa !5
  %27 = icmp slt i32 %.05584, %26
  br i1 %27, label %.lr.ph79, label %.critedge

.lr.ph79:                                         ; preds = %.preheader68
  %28 = getelementptr inbounds [200001 x %struct.Query], ptr @query, i64 0, i64 %indvars.iv117, i32 3
  %29 = sext i32 %.05584 to i64
  br label %32

._crit_edge85:                                    ; preds = %.critedge, %._crit_edge76
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1048580) @seg, i8 0, i64 1048580, i1 false)
  tail call void @_ZSt4swapIiENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 4 dereferenceable(4) @n, ptr noundef nonnull align 4 dereferenceable(4) @m) #6
  %30 = load i32, ptr @k, align 4, !tbaa !5
  %31 = icmp sgt i32 %30, 0
  br i1 %31, label %.lr.ph88, label %._crit_edge85.._crit_edge89_crit_edge

._crit_edge85.._crit_edge89_crit_edge:            ; preds = %._crit_edge85
  %.pre143 = sext i32 %30 to i64
  br label %._crit_edge89

32:                                               ; preds = %.lr.ph79, %36
  %indvars.iv114 = phi i64 [ %29, %.lr.ph79 ], [ %indvars.iv.next115, %36 ]
  %33 = getelementptr inbounds [200001 x %struct.Point], ptr @rook, i64 0, i64 %indvars.iv114
  %34 = load i32, ptr %33, align 8, !tbaa !14
  %35 = load i32, ptr %28, align 4, !tbaa !16
  %.not66 = icmp sgt i32 %34, %35
  br i1 %.not66, label %.critedge.loopexit, label %36

36:                                               ; preds = %32
  %37 = load i32, ptr @m, align 4, !tbaa !5
  %38 = getelementptr inbounds i8, ptr %33, i64 4
  %39 = load i32, ptr %38, align 4, !tbaa !17
  tail call void @_Z3updiiiii(i32 noundef 1, i32 noundef 1, i32 noundef %37, i32 noundef %39, i32 noundef %34)
  %indvars.iv.next115 = add nsw i64 %indvars.iv114, 1
  %40 = load i32, ptr @k, align 4, !tbaa !5
  %41 = sext i32 %40 to i64
  %42 = icmp slt i64 %indvars.iv.next115, %41
  br i1 %42, label %32, label %.critedge.loopexit, !llvm.loop !18

.critedge.loopexit:                               ; preds = %36, %32
  %.156.lcssa.ph.in = phi i64 [ %indvars.iv114, %32 ], [ %indvars.iv.next115, %36 ]
  %.156.lcssa.ph = trunc i64 %.156.lcssa.ph.in to i32
  br label %.critedge

.critedge:                                        ; preds = %.critedge.loopexit, %.preheader68
  %.156.lcssa = phi i32 [ %.05584, %.preheader68 ], [ %.156.lcssa.ph, %.critedge.loopexit ]
  %43 = load i32, ptr @m, align 4, !tbaa !5
  %44 = getelementptr inbounds [200001 x %struct.Query], ptr @query, i64 0, i64 %indvars.iv117
  %45 = getelementptr inbounds i8, ptr %44, i64 8
  %46 = load i32, ptr %45, align 4, !tbaa !19
  %47 = getelementptr inbounds i8, ptr %44, i64 16
  %48 = load i32, ptr %47, align 4, !tbaa !20
  %49 = tail call noundef i32 @_Z3queiiiii(i32 noundef 1, i32 noundef 1, i32 noundef %43, i32 noundef %46, i32 noundef %48)
  %50 = getelementptr inbounds i8, ptr %44, i64 4
  %51 = load i32, ptr %50, align 4, !tbaa !21
  %52 = icmp sge i32 %49, %51
  %53 = load i32, ptr %44, align 4, !tbaa !11
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds [200001 x i8], ptr @ans, i64 0, i64 %54
  %56 = load i8, ptr %55, align 1, !tbaa !22, !range !24, !noundef !25
  %57 = zext i1 %52 to i8
  %58 = or i8 %56, %57
  store i8 %58, ptr %55, align 1, !tbaa !22
  %indvars.iv.next118 = add nuw nsw i64 %indvars.iv117, 1
  %59 = load i32, ptr @q, align 4, !tbaa !5
  %60 = sext i32 %59 to i64
  %61 = icmp slt i64 %indvars.iv.next118, %60
  br i1 %61, label %.preheader68, label %._crit_edge85, !llvm.loop !26

._crit_edge89:                                    ; preds = %.lr.ph88, %._crit_edge85.._crit_edge89_crit_edge
  %.pre-phi144 = phi i64 [ %.pre143, %._crit_edge85.._crit_edge89_crit_edge ], [ %68, %.lr.ph88 ]
  %62 = getelementptr inbounds %struct.Point, ptr @rook, i64 %.pre-phi144
  tail call void @_ZSt4sortIP5PointEvT_S2_(ptr noundef nonnull @rook, ptr noundef nonnull %62)
  %63 = load i32, ptr @q, align 4, !tbaa !5
  %64 = icmp sgt i32 %63, 0
  br i1 %64, label %.lr.ph93, label %._crit_edge89.._crit_edge94_crit_edge

._crit_edge89.._crit_edge94_crit_edge:            ; preds = %._crit_edge89
  %.pre145 = sext i32 %63 to i64
  br label %._crit_edge94

.lr.ph88:                                         ; preds = %._crit_edge85, %.lr.ph88
  %indvars.iv121 = phi i64 [ %indvars.iv.next122, %.lr.ph88 ], [ 0, %._crit_edge85 ]
  %65 = getelementptr inbounds [200001 x %struct.Point], ptr @rook, i64 0, i64 %indvars.iv121
  %66 = getelementptr inbounds i8, ptr %65, i64 4
  tail call void @_ZSt4swapIiENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 4 dereferenceable(4) %65, ptr noundef nonnull align 4 dereferenceable(4) %66) #6
  %indvars.iv.next122 = add nuw nsw i64 %indvars.iv121, 1
  %67 = load i32, ptr @k, align 4, !tbaa !5
  %68 = sext i32 %67 to i64
  %69 = icmp slt i64 %indvars.iv.next122, %68
  br i1 %69, label %.lr.ph88, label %._crit_edge89, !llvm.loop !27

._crit_edge94:                                    ; preds = %.lr.ph93, %._crit_edge89.._crit_edge94_crit_edge
  %.pre-phi146 = phi i64 [ %.pre145, %._crit_edge89.._crit_edge94_crit_edge ], [ %79, %.lr.ph93 ]
  %70 = getelementptr inbounds %struct.Query, ptr @query, i64 %.pre-phi146
  tail call void @_ZSt4sortIP5QueryEvT_S2_(ptr noundef nonnull @query, ptr noundef nonnull %70)
  %71 = load i32, ptr @q, align 4, !tbaa !5
  %72 = icmp sgt i32 %71, 0
  br i1 %72, label %.preheader67, label %._crit_edge105

.lr.ph93:                                         ; preds = %._crit_edge89, %.lr.ph93
  %indvars.iv125 = phi i64 [ %indvars.iv.next126, %.lr.ph93 ], [ 0, %._crit_edge89 ]
  %73 = getelementptr inbounds [200001 x %struct.Query], ptr @query, i64 0, i64 %indvars.iv125
  %74 = getelementptr inbounds i8, ptr %73, i64 4
  %75 = getelementptr inbounds i8, ptr %73, i64 8
  tail call void @_ZSt4swapIiENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 4 dereferenceable(4) %74, ptr noundef nonnull align 4 dereferenceable(4) %75) #6
  %76 = getelementptr inbounds i8, ptr %73, i64 12
  %77 = getelementptr inbounds i8, ptr %73, i64 16
  tail call void @_ZSt4swapIiENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 4 dereferenceable(4) %76, ptr noundef nonnull align 4 dereferenceable(4) %77) #6
  %indvars.iv.next126 = add nuw nsw i64 %indvars.iv125, 1
  %78 = load i32, ptr @q, align 4, !tbaa !5
  %79 = sext i32 %78 to i64
  %80 = icmp slt i64 %indvars.iv.next126, %79
  br i1 %80, label %.lr.ph93, label %._crit_edge94, !llvm.loop !28

.preheader67:                                     ; preds = %._crit_edge94, %.critedge2
  %indvars.iv133 = phi i64 [ %indvars.iv.next134, %.critedge2 ], [ 0, %._crit_edge94 ]
  %.051102 = phi i32 [ %.1.lcssa, %.critedge2 ], [ 0, %._crit_edge94 ]
  %81 = load i32, ptr @k, align 4, !tbaa !5
  %82 = icmp slt i32 %.051102, %81
  br i1 %82, label %.lr.ph97, label %.critedge2

.lr.ph97:                                         ; preds = %.preheader67
  %83 = getelementptr inbounds [200001 x %struct.Query], ptr @query, i64 0, i64 %indvars.iv133, i32 3
  %84 = sext i32 %.051102 to i64
  br label %86

.preheader:                                       ; preds = %.critedge2
  %85 = icmp sgt i32 %113, 0
  br i1 %85, label %.lr.ph104, label %._crit_edge105

86:                                               ; preds = %.lr.ph97, %90
  %indvars.iv129 = phi i64 [ %84, %.lr.ph97 ], [ %indvars.iv.next130, %90 ]
  %87 = getelementptr inbounds [200001 x %struct.Point], ptr @rook, i64 0, i64 %indvars.iv129
  %88 = load i32, ptr %87, align 8, !tbaa !14
  %89 = load i32, ptr %83, align 4, !tbaa !16
  %.not = icmp sgt i32 %88, %89
  br i1 %.not, label %.critedge2.loopexit, label %90

90:                                               ; preds = %86
  %91 = load i32, ptr @m, align 4, !tbaa !5
  %92 = getelementptr inbounds i8, ptr %87, i64 4
  %93 = load i32, ptr %92, align 4, !tbaa !17
  tail call void @_Z3updiiiii(i32 noundef 1, i32 noundef 1, i32 noundef %91, i32 noundef %93, i32 noundef %88)
  %indvars.iv.next130 = add nsw i64 %indvars.iv129, 1
  %94 = load i32, ptr @k, align 4, !tbaa !5
  %95 = sext i32 %94 to i64
  %96 = icmp slt i64 %indvars.iv.next130, %95
  br i1 %96, label %86, label %.critedge2.loopexit, !llvm.loop !29

.critedge2.loopexit:                              ; preds = %90, %86
  %.1.lcssa.ph.in = phi i64 [ %indvars.iv129, %86 ], [ %indvars.iv.next130, %90 ]
  %.1.lcssa.ph = trunc i64 %.1.lcssa.ph.in to i32
  br label %.critedge2

.critedge2:                                       ; preds = %.critedge2.loopexit, %.preheader67
  %.1.lcssa = phi i32 [ %.051102, %.preheader67 ], [ %.1.lcssa.ph, %.critedge2.loopexit ]
  %97 = load i32, ptr @m, align 4, !tbaa !5
  %98 = getelementptr inbounds [200001 x %struct.Query], ptr @query, i64 0, i64 %indvars.iv133
  %99 = getelementptr inbounds i8, ptr %98, i64 8
  %100 = load i32, ptr %99, align 4, !tbaa !19
  %101 = getelementptr inbounds i8, ptr %98, i64 16
  %102 = load i32, ptr %101, align 4, !tbaa !20
  %103 = tail call noundef i32 @_Z3queiiiii(i32 noundef 1, i32 noundef 1, i32 noundef %97, i32 noundef %100, i32 noundef %102)
  %104 = getelementptr inbounds i8, ptr %98, i64 4
  %105 = load i32, ptr %104, align 4, !tbaa !21
  %106 = icmp sge i32 %103, %105
  %107 = load i32, ptr %98, align 4, !tbaa !11
  %108 = sext i32 %107 to i64
  %109 = getelementptr inbounds [200001 x i8], ptr @ans, i64 0, i64 %108
  %110 = load i8, ptr %109, align 1, !tbaa !22, !range !24, !noundef !25
  %111 = zext i1 %106 to i8
  %112 = or i8 %110, %111
  store i8 %112, ptr %109, align 1, !tbaa !22
  %indvars.iv.next134 = add nuw nsw i64 %indvars.iv133, 1
  %113 = load i32, ptr @q, align 4, !tbaa !5
  %114 = sext i32 %113 to i64
  %115 = icmp slt i64 %indvars.iv.next134, %114
  br i1 %115, label %.preheader67, label %.preheader, !llvm.loop !30

._crit_edge105:                                   ; preds = %.lr.ph104, %._crit_edge94, %.preheader
  ret i32 0

.lr.ph104:                                        ; preds = %.preheader, %.lr.ph104
  %indvars.iv137 = phi i64 [ %indvars.iv.next138, %.lr.ph104 ], [ 0, %.preheader ]
  %116 = getelementptr inbounds [200001 x i8], ptr @ans, i64 0, i64 %indvars.iv137
  %117 = load i8, ptr %116, align 1, !tbaa !22, !range !24, !noundef !25
  %118 = trunc nuw i8 %117 to i1
  %119 = select i1 %118, ptr @.str.2, ptr @.str.3
  %120 = tail call i32 @puts(ptr noundef nonnull dereferenceable(1) %119)
  %indvars.iv.next138 = add nuw nsw i64 %indvars.iv137, 1
  %121 = load i32, ptr @q, align 4, !tbaa !5
  %122 = sext i32 %121 to i64
  %123 = icmp slt i64 %indvars.iv.next138, %122
  br i1 %123, label %.lr.ph104, label %._crit_edge105, !llvm.loop !31
}

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

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

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

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

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

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

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

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

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


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