; LLVM IR from sunkafei/xcpc-algorithm-templates :: 算法/莫队算法/带修改莫队.ll (Z4workiSt6vectorI5querySaIS0_EE)

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

%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<query, std::allocator<query>>::_Vector_impl" }
%"struct.std::_Vector_base<query, std::allocator<query>>::_Vector_impl" = type { %"struct.std::_Vector_base<query, std::allocator<query>>::_Vector_impl_data" }
%"struct.std::_Vector_base<query, std::allocator<query>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.__gnu_cxx::__normal_iterator" = type { ptr }
%struct.query = type { i32, i32, i32, i32, i32 }

@belong = external dso_local global [210000 x i32], align 16
@ans = external dso_local global [210000 x i32], align 16

; Function Attrs: mustprogress uwtable
define dso_local void @_Z4workiSt6vectorI5querySaIS0_EE(i32 noundef %0, ptr noundef %1) #0 personality ptr @__gxx_personality_v0 {
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %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 %"class.std::vector", align 8
  %11 = alloca %"class.std::vector", align 8
  %12 = alloca ptr, align 8
  %13 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %14 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %15 = alloca %struct.query, align 4
  %16 = alloca ptr, align 8
  %17 = alloca i32, align 4
  %18 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %19 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %20 = alloca i32, align 4
  %21 = alloca i32, align 4
  %22 = alloca i32, align 4
  %23 = alloca ptr, align 8
  %24 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %25 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %26 = alloca %struct.query, align 4
  store i32 %0, ptr %3, align 4, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #7
  %27 = load i32, ptr %3, align 4, !tbaa !5
  %28 = call noundef double @_ZSt3powIidEN9__gnu_cxx9__promoteIDTplcvNS1_IT_Xsr3std12__is_integerIS2_EE7__valueEE6__typeELi0EcvNS1_IT0_Xsr3std12__is_integerIS5_EE7__valueEE6__typeELi0EEXsr3std12__is_integerIS8_EE7__valueEE6__typeES2_S5_(i32 noundef %27, double noundef 0x3FE5555555555555)
  %29 = fptosi double %28 to i32
  store i32 %29, ptr %5, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #7
  %30 = load i32, ptr %3, align 4, !tbaa !5
  %31 = sitofp i32 %30 to double
  %32 = load i32, ptr %5, align 4, !tbaa !5
  %33 = sitofp i32 %32 to double
  %34 = fdiv double %31, %33
  %35 = call double @llvm.ceil.f64(double %34)
  %36 = fptosi double %35 to i32
  store i32 %36, ptr %6, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #7
  store i32 1, ptr %7, align 4, !tbaa !5
  br label %37

37:                                               ; preds = %64, %2
  %38 = load i32, ptr %7, align 4, !tbaa !5
  %39 = load i32, ptr %6, align 4, !tbaa !5
  %40 = icmp sle i32 %38, %39
  br i1 %40, label %42, label %41

41:                                               ; preds = %37
  store i32 2, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #7
  br label %67

42:                                               ; preds = %37
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #7
  %43 = load i32, ptr %7, align 4, !tbaa !5
  %44 = sub nsw i32 %43, 1
  %45 = load i32, ptr %5, align 4, !tbaa !5
  %46 = mul nsw i32 %44, %45
  %47 = add nsw i32 %46, 1
  store i32 %47, ptr %9, align 4, !tbaa !5
  br label %48

48:                                               ; preds = %60, %42
  %49 = load i32, ptr %9, align 4, !tbaa !5
  %50 = load i32, ptr %7, align 4, !tbaa !5
  %51 = load i32, ptr %5, align 4, !tbaa !5
  %52 = mul nsw i32 %50, %51
  %53 = icmp sle i32 %49, %52
  br i1 %53, label %55, label %54

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

55:                                               ; preds = %48
  %56 = load i32, ptr %7, align 4, !tbaa !5
  %57 = load i32, ptr %9, align 4, !tbaa !5
  %58 = sext i32 %57 to i64
  %59 = getelementptr inbounds [210000 x i32], ptr @belong, i64 0, i64 %58
  store i32 %56, ptr %59, align 4, !tbaa !5
  br label %60

60:                                               ; preds = %55
  %61 = load i32, ptr %9, align 4, !tbaa !5
  %62 = add nsw i32 %61, 1
  store i32 %62, ptr %9, align 4, !tbaa !5
  br label %48, !llvm.loop !11

63:                                               ; preds = %54
  br label %64

64:                                               ; preds = %63
  %65 = load i32, ptr %7, align 4, !tbaa !5
  %66 = add nsw i32 %65, 1
  store i32 %66, ptr %7, align 4, !tbaa !5
  br label %37, !llvm.loop !13

67:                                               ; preds = %41
  call void @llvm.lifetime.start.p0(i64 24, ptr %10) #7
  call void @_ZNSt6vectorI5querySaIS0_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %10) #7
  call void @llvm.lifetime.start.p0(i64 24, ptr %11) #7
  call void @_ZNSt6vectorI5querySaIS0_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %11) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #7
  store ptr %1, ptr %12, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #7
  %68 = load ptr, ptr %12, align 8, !tbaa !9
  %69 = call ptr @_ZNSt6vectorI5querySaIS0_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %68) #7
  %70 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %13, i32 0, i32 0
  store ptr %69, ptr %70, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #7
  %71 = load ptr, ptr %12, align 8, !tbaa !9
  %72 = call ptr @_ZNSt6vectorI5querySaIS0_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %71) #7
  %73 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %14, i32 0, i32 0
  store ptr %72, ptr %73, align 8
  br label %74

74:                                               ; preds = %97, %67
  %75 = call noundef zeroext i1 @_ZN9__gnu_cxxneIP5querySt6vectorIS1_SaIS1_EEEEbRKNS_17__normal_iteratorIT_T0_EESB_(ptr noundef nonnull align 8 dereferenceable(8) %13, ptr noundef nonnull align 8 dereferenceable(8) %14) #7
  br i1 %75, label %77, label %76

76:                                               ; preds = %74
  store i32 8, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #7
  br label %99

77:                                               ; preds = %74
  call void @llvm.lifetime.start.p0(i64 20, ptr %15) #7
  %78 = call noundef nonnull align 4 dereferenceable(20) ptr @_ZNK9__gnu_cxx17__normal_iteratorIP5querySt6vectorIS1_SaIS1_EEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %13) #7
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %15, ptr align 4 %78, i64 20, i1 false), !tbaa.struct !14
  %79 = getelementptr inbounds %struct.query, ptr %15, i32 0, i32 0
  %80 = load i32, ptr %79, align 4, !tbaa !15
  %81 = icmp eq i32 %80, 0
  br i1 %81, label %82, label %94

82:                                               ; preds = %77
  %83 = call noundef i64 @_ZNKSt6vectorI5querySaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %10) #7
  %84 = trunc i64 %83 to i32
  %85 = getelementptr inbounds %struct.query, ptr %15, i32 0, i32 3
  store i32 %84, ptr %85, align 4, !tbaa !17
  %86 = call noundef i64 @_ZNKSt6vectorI5querySaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %11) #7
  %87 = trunc i64 %86 to i32
  %88 = getelementptr inbounds %struct.query, ptr %15, i32 0, i32 4
  store i32 %87, ptr %88, align 4, !tbaa !18
  invoke void @_ZNSt6vectorI5querySaIS0_EE9push_backERKS0_(ptr noundef nonnull align 8 dereferenceable(24) %10, ptr noundef nonnull align 4 dereferenceable(20) %15)
          to label %89 unwind label %90

89:                                               ; preds = %82
  br label %96

90:                                               ; preds = %94, %82
  %91 = landingpad { ptr, i32 }
          cleanup
  %92 = extractvalue { ptr, i32 } %91, 0
  store ptr %92, ptr %16, align 8
  %93 = extractvalue { ptr, i32 } %91, 1
  store i32 %93, ptr %17, align 4
  call void @llvm.lifetime.end.p0(i64 20, ptr %15) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #7
  br label %241

94:                                               ; preds = %77
  invoke void @_ZNSt6vectorI5querySaIS0_EE9push_backERKS0_(ptr noundef nonnull align 8 dereferenceable(24) %11, ptr noundef nonnull align 4 dereferenceable(20) %15)
          to label %95 unwind label %90

95:                                               ; preds = %94
  br label %96

96:                                               ; preds = %95, %89
  call void @llvm.lifetime.end.p0(i64 20, ptr %15) #7
  br label %97

97:                                               ; preds = %96
  %98 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIP5querySt6vectorIS1_SaIS1_EEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %13) #7
  br label %74

99:                                               ; preds = %76
  %100 = call ptr @_ZNSt6vectorI5querySaIS0_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %10) #7
  %101 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %18, i32 0, i32 0
  store ptr %100, ptr %101, align 8
  %102 = call ptr @_ZNSt6vectorI5querySaIS0_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %10) #7
  %103 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %19, i32 0, i32 0
  store ptr %102, ptr %103, align 8
  %104 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %18, i32 0, i32 0
  %105 = load ptr, ptr %104, align 8
  %106 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %19, i32 0, i32 0
  %107 = load ptr, ptr %106, align 8
  invoke void @_ZSt4sortIN9__gnu_cxx17__normal_iteratorIP5querySt6vectorIS2_SaIS2_EEEEEvT_S8_(ptr %105, ptr %107)
          to label %108 unwind label %118

108:                                              ; preds = %99
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #7
  store i32 1, ptr %20, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #7
  store i32 0, ptr %21, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #7
  store i32 0, ptr %22, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #7
  store ptr %10, ptr %23, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #7
  %109 = load ptr, ptr %23, align 8, !tbaa !9
  %110 = call ptr @_ZNSt6vectorI5querySaIS0_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %109) #7
  %111 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %24, i32 0, i32 0
  store ptr %110, ptr %111, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %25) #7
  %112 = load ptr, ptr %23, align 8, !tbaa !9
  %113 = call ptr @_ZNSt6vectorI5querySaIS0_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %112) #7
  %114 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %25, i32 0, i32 0
  store ptr %113, ptr %114, align 8
  br label %115

115:                                              ; preds = %238, %108
  %116 = call noundef zeroext i1 @_ZN9__gnu_cxxneIP5querySt6vectorIS1_SaIS1_EEEEbRKNS_17__normal_iteratorIT_T0_EESB_(ptr noundef nonnull align 8 dereferenceable(8) %24, ptr noundef nonnull align 8 dereferenceable(8) %25) #7
  br i1 %116, label %122, label %117

117:                                              ; preds = %115
  store i32 10, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #7
  br label %240

118:                                              ; preds = %99
  %119 = landingpad { ptr, i32 }
          cleanup
  %120 = extractvalue { ptr, i32 } %119, 0
  store ptr %120, ptr %16, align 8
  %121 = extractvalue { ptr, i32 } %119, 1
  store i32 %121, ptr %17, align 4
  br label %241

122:                                              ; preds = %115
  call void @llvm.lifetime.start.p0(i64 20, ptr %26) #7
  %123 = call noundef nonnull align 4 dereferenceable(20) ptr @_ZNK9__gnu_cxx17__normal_iteratorIP5querySt6vectorIS1_SaIS1_EEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %24) #7
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %26, ptr align 4 %123, i64 20, i1 false), !tbaa.struct !14
  br label %124

124:                                              ; preds = %132, %122
  %125 = load i32, ptr %20, align 4, !tbaa !5
  %126 = getelementptr inbounds %struct.query, ptr %26, i32 0, i32 1
  %127 = load i32, ptr %126, align 4, !tbaa !19
  %128 = icmp slt i32 %125, %127
  br i1 %128, label %129, label %137

129:                                              ; preds = %124
  %130 = load i32, ptr %20, align 4, !tbaa !5
  %131 = add nsw i32 %130, 1
  store i32 %131, ptr %20, align 4, !tbaa !5
  invoke void @_Z3deli(i32 noundef %130)
          to label %132 unwind label %133

132:                                              ; preds = %129
  br label %124, !llvm.loop !20

133:                                              ; preds = %231, %228, %194, %163, %153, %143, %129
  %134 = landingpad { ptr, i32 }
          cleanup
  %135 = extractvalue { ptr, i32 } %134, 0
  store ptr %135, ptr %16, align 8
  %136 = extractvalue { ptr, i32 } %134, 1
  store i32 %136, ptr %17, align 4
  call void @llvm.lifetime.end.p0(i64 20, ptr %26) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #7
  br label %241

137:                                              ; preds = %124
  br label %138

138:                                              ; preds = %146, %137
  %139 = load i32, ptr %20, align 4, !tbaa !5
  %140 = getelementptr inbounds %struct.query, ptr %26, i32 0, i32 1
  %141 = load i32, ptr %140, align 4, !tbaa !19
  %142 = icmp sgt i32 %139, %141
  br i1 %142, label %143, label %147

143:                                              ; preds = %138
  %144 = load i32, ptr %20, align 4, !tbaa !5
  %145 = add nsw i32 %144, -1
  store i32 %145, ptr %20, align 4, !tbaa !5
  invoke void @_Z3addi(i32 noundef %145)
          to label %146 unwind label %133

146:                                              ; preds = %143
  br label %138, !llvm.loop !21

147:                                              ; preds = %138
  br label %148

148:                                              ; preds = %156, %147
  %149 = load i32, ptr %21, align 4, !tbaa !5
  %150 = getelementptr inbounds %struct.query, ptr %26, i32 0, i32 2
  %151 = load i32, ptr %150, align 4, !tbaa !22
  %152 = icmp slt i32 %149, %151
  br i1 %152, label %153, label %157

153:                                              ; preds = %148
  %154 = load i32, ptr %21, align 4, !tbaa !5
  %155 = add nsw i32 %154, 1
  store i32 %155, ptr %21, align 4, !tbaa !5
  invoke void @_Z3addi(i32 noundef %155)
          to label %156 unwind label %133

156:                                              ; preds = %153
  br label %148, !llvm.loop !23

157:                                              ; preds = %148
  br label %158

158:                                              ; preds = %166, %157
  %159 = load i32, ptr %21, align 4, !tbaa !5
  %160 = getelementptr inbounds %struct.query, ptr %26, i32 0, i32 2
  %161 = load i32, ptr %160, align 4, !tbaa !22
  %162 = icmp sgt i32 %159, %161
  br i1 %162, label %163, label %167

163:                                              ; preds = %158
  %164 = load i32, ptr %21, align 4, !tbaa !5
  %165 = add nsw i32 %164, -1
  store i32 %165, ptr %21, align 4, !tbaa !5
  invoke void @_Z3deli(i32 noundef %164)
          to label %166 unwind label %133

166:                                              ; preds = %163
  br label %158, !llvm.loop !24

167:                                              ; preds = %158
  br label %168

168:                                              ; preds = %196, %167
  %169 = load i32, ptr %22, align 4, !tbaa !5
  %170 = getelementptr inbounds %struct.query, ptr %26, i32 0, i32 4
  %171 = load i32, ptr %170, align 4, !tbaa !18
  %172 = icmp slt i32 %169, %171
  br i1 %172, label %173, label %199

173:                                              ; preds = %168
  %174 = load i32, ptr %22, align 4, !tbaa !5
  %175 = sext i32 %174 to i64
  %176 = call noundef nonnull align 4 dereferenceable(20) ptr @_ZNSt6vectorI5querySaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %11, i64 noundef %175) #7
  %177 = getelementptr inbounds %struct.query, ptr %26, i32 0, i32 1
  %178 = load i32, ptr %177, align 4, !tbaa !19
  %179 = load i32, ptr %22, align 4, !tbaa !5
  %180 = sext i32 %179 to i64
  %181 = call noundef nonnull align 4 dereferenceable(20) ptr @_ZNSt6vectorI5querySaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %11, i64 noundef %180) #7
  %182 = getelementptr inbounds %struct.query, ptr %181, i32 0, i32 1
  %183 = load i32, ptr %182, align 4, !tbaa !19
  %184 = icmp sle i32 %178, %183
  br i1 %184, label %185, label %194

185:                                              ; preds = %173
  %186 = getelementptr inbounds %struct.query, ptr %26, i32 0, i32 2
  %187 = load i32, ptr %186, align 4, !tbaa !22
  %188 = load i32, ptr %22, align 4, !tbaa !5
  %189 = sext i32 %188 to i64
  %190 = call noundef nonnull align 4 dereferenceable(20) ptr @_ZNSt6vectorI5querySaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %11, i64 noundef %189) #7
  %191 = getelementptr inbounds %struct.query, ptr %190, i32 0, i32 1
  %192 = load i32, ptr %191, align 4, !tbaa !19
  %193 = icmp sge i32 %187, %192
  br label %194

194:                                              ; preds = %185, %173
  %195 = phi i1 [ false, %173 ], [ %193, %185 ]
  invoke void @_Z6changeR5queryb(ptr noundef nonnull align 4 dereferenceable(20) %176, i1 noundef zeroext %195)
          to label %196 unwind label %133

196:                                              ; preds = %194
  %197 = load i32, ptr %22, align 4, !tbaa !5
  %198 = add nsw i32 %197, 1
  store i32 %198, ptr %22, align 4, !tbaa !5
  br label %168, !llvm.loop !25

199:                                              ; preds = %168
  br label %200

200:                                              ; preds = %230, %199
  %201 = load i32, ptr %22, align 4, !tbaa !5
  %202 = getelementptr inbounds %struct.query, ptr %26, i32 0, i32 4
  %203 = load i32, ptr %202, align 4, !tbaa !18
  %204 = icmp sgt i32 %201, %203
  br i1 %204, label %205, label %231

205:                                              ; preds = %200
  %206 = load i32, ptr %22, align 4, !tbaa !5
  %207 = add nsw i32 %206, -1
  store i32 %207, ptr %22, align 4, !tbaa !5
  %208 = load i32, ptr %22, align 4, !tbaa !5
  %209 = sext i32 %208 to i64
  %210 = call noundef nonnull align 4 dereferenceable(20) ptr @_ZNSt6vectorI5querySaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %11, i64 noundef %209) #7
  %211 = getelementptr inbounds %struct.query, ptr %26, i32 0, i32 1
  %212 = load i32, ptr %211, align 4, !tbaa !19
  %213 = load i32, ptr %22, align 4, !tbaa !5
  %214 = sext i32 %213 to i64
  %215 = call noundef nonnull align 4 dereferenceable(20) ptr @_ZNSt6vectorI5querySaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %11, i64 noundef %214) #7
  %216 = getelementptr inbounds %struct.query, ptr %215, i32 0, i32 1
  %217 = load i32, ptr %216, align 4, !tbaa !19
  %218 = icmp sle i32 %212, %217
  br i1 %218, label %219, label %228

219:                                              ; preds = %205
  %220 = getelementptr inbounds %struct.query, ptr %26, i32 0, i32 2
  %221 = load i32, ptr %220, align 4, !tbaa !22
  %222 = load i32, ptr %22, align 4, !tbaa !5
  %223 = sext i32 %222 to i64
  %224 = call noundef nonnull align 4 dereferenceable(20) ptr @_ZNSt6vectorI5querySaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %11, i64 noundef %223) #7
  %225 = getelementptr inbounds %struct.query, ptr %224, i32 0, i32 1
  %226 = load i32, ptr %225, align 4, !tbaa !19
  %227 = icmp sge i32 %221, %226
  br label %228

228:                                              ; preds = %219, %205
  %229 = phi i1 [ false, %205 ], [ %227, %219 ]
  invoke void @_Z4undoR5queryb(ptr noundef nonnull align 4 dereferenceable(20) %210, i1 noundef zeroext %229)
          to label %230 unwind label %133

230:                                              ; preds = %228
  br label %200, !llvm.loop !26

231:                                              ; preds = %200
  %232 = invoke noundef i32 @_Z7get_ansv()
          to label %233 unwind label %133

233:                                              ; preds = %231
  %234 = getelementptr inbounds %struct.query, ptr %26, i32 0, i32 3
  %235 = load i32, ptr %234, align 4, !tbaa !17
  %236 = sext i32 %235 to i64
  %237 = getelementptr inbounds [210000 x i32], ptr @ans, i64 0, i64 %236
  store i32 %232, ptr %237, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 20, ptr %26) #7
  br label %238

238:                                              ; preds = %233
  %239 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIP5querySt6vectorIS1_SaIS1_EEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %24) #7
  br label %115

240:                                              ; preds = %117
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #7
  call void @_ZNSt6vectorI5querySaIS0_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %11) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr %11) #7
  call void @_ZNSt6vectorI5querySaIS0_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %10) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr %10) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #7
  ret void

241:                                              ; preds = %133, %118, %90
  call void @_ZNSt6vectorI5querySaIS0_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %11) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr %11) #7
  call void @_ZNSt6vectorI5querySaIS0_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %10) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr %10) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #7
  br label %242

242:                                              ; preds = %241
  %243 = load ptr, ptr %16, align 8
  %244 = load i32, ptr %17, align 4
  %245 = insertvalue { ptr, i32 } poison, ptr %243, 0
  %246 = insertvalue { ptr, i32 } %245, i32 %244, 1
  resume { ptr, i32 } %246
}

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef double @_ZSt3powIidEN9__gnu_cxx9__promoteIDTplcvNS1_IT_Xsr3std12__is_integerIS2_EE7__valueEE6__typeELi0EcvNS1_IT0_Xsr3std12__is_integerIS5_EE7__valueEE6__typeELi0EEXsr3std12__is_integerIS8_EE7__valueEE6__typeES2_S5_(i32 noundef, double noundef) #2

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.ceil.f64(double) #3

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN9__gnu_cxxneIP5querySt6vectorIS1_SaIS1_EEEEbRKNS_17__normal_iteratorIT_T0_EESB_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(20) ptr @_ZNK9__gnu_cxx17__normal_iteratorIP5querySt6vectorIS1_SaIS1_EEEdeEv(ptr noundef nonnull align 8 dereferenceable(8)) #4 align 2

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorI5querySaIS0_EE9push_backERKS0_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 4 dereferenceable(20)) #0 align 2

declare i32 @__gxx_personality_v0(...)

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

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_Z6changeR5queryb(ptr noundef nonnull align 4 dereferenceable(20), i1 noundef zeroext) #2

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_Z4undoR5queryb(ptr noundef nonnull align 4 dereferenceable(20), i1 noundef zeroext) #2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z7get_ansv() #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorI5querySaIS0_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #4 align 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = { nounwind }

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

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


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

%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<query, std::allocator<query>>::_Vector_impl" }
%"struct.std::_Vector_base<query, std::allocator<query>>::_Vector_impl" = type { %"struct.std::_Vector_base<query, std::allocator<query>>::_Vector_impl_data" }
%"struct.std::_Vector_base<query, std::allocator<query>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.__gnu_cxx::__normal_iterator" = type { ptr }
%struct.query = type { i32, i32, i32, i32, i32 }

@belong = external dso_local local_unnamed_addr global [210000 x i32], align 16
@ans = external dso_local local_unnamed_addr global [210000 x i32], align 16

; Function Attrs: mustprogress uwtable
define dso_local void @_Z4workiSt6vectorI5querySaIS0_EE(i32 noundef %0, ptr noundef %1) local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
  %3 = alloca %"class.std::vector", align 8
  %4 = alloca %"class.std::vector", align 8
  %5 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %6 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %7 = alloca %struct.query, align 4
  %8 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %9 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %10 = tail call noundef double @_ZSt3powIidEN9__gnu_cxx9__promoteIDTplcvNS1_IT_Xsr3std12__is_integerIS2_EE7__valueEE6__typeELi0EcvNS1_IT0_Xsr3std12__is_integerIS5_EE7__valueEE6__typeELi0EEXsr3std12__is_integerIS8_EE7__valueEE6__typeES2_S5_(i32 noundef %0, double noundef 0x3FE5555555555555)
  %11 = fptosi double %10 to i32
  %12 = sitofp i32 %0 to double
  %13 = sitofp i32 %11 to double
  %14 = fdiv double %12, %13
  %15 = tail call double @llvm.ceil.f64(double %14)
  %16 = fptosi double %15 to i32
  %.not66 = icmp slt i32 %16, 1
  br i1 %.not66, label %._crit_edge70, label %.lr.ph69.preheader

.lr.ph69.preheader:                               ; preds = %2
  %17 = sext i32 %11 to i64
  %18 = add i32 %11, -1
  %19 = zext i32 %18 to i64
  %20 = add nuw nsw i64 %19, 1
  %min.iters.check = icmp ult i32 %18, 7
  %n.vec = and i64 %20, 8589934584
  %cmp.n = icmp eq i64 %20, %n.vec
  br label %.lr.ph69

._crit_edge70:                                    ; preds = %._crit_edge, %2
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %3) #7
  call void @_ZNSt6vectorI5querySaIS0_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %3) #7
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %4) #7
  call void @_ZNSt6vectorI5querySaIS0_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %4) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #7
  %21 = call ptr @_ZNSt6vectorI5querySaIS0_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %1) #7
  store ptr %21, ptr %5, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #7
  %22 = call ptr @_ZNSt6vectorI5querySaIS0_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %1) #7
  store ptr %22, ptr %6, align 8
  %23 = call noundef zeroext i1 @_ZN9__gnu_cxxneIP5querySt6vectorIS1_SaIS1_EEEEbRKNS_17__normal_iteratorIT_T0_EESB_(ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef nonnull align 8 dereferenceable(8) %6) #7
  br i1 %23, label %.lr.ph72, label %._crit_edge73

.lr.ph72:                                         ; preds = %._crit_edge70
  %24 = getelementptr inbounds i8, ptr %7, i64 12
  %25 = getelementptr inbounds i8, ptr %7, i64 16
  br label %37

.lr.ph69:                                         ; preds = %.lr.ph69.preheader, %._crit_edge
  %indvars.iv107 = phi i32 [ %11, %.lr.ph69.preheader ], [ %indvars.iv.next108, %._crit_edge ]
  %indvars.iv = phi i64 [ 0, %.lr.ph69.preheader ], [ %indvars.iv.next, %._crit_edge ]
  %.067 = phi i32 [ 1, %.lr.ph69.preheader ], [ %33, %._crit_edge ]
  %26 = add nsw i32 %.067, -1
  %27 = mul nsw i32 %26, %11
  %28 = mul nsw i32 %.067, %11
  %.not59.not64 = icmp slt i32 %27, %28
  br i1 %.not59.not64, label %.lr.ph.preheader, label %._crit_edge

.lr.ph.preheader:                                 ; preds = %.lr.ph69
  br i1 %min.iters.check, label %.lr.ph.preheader132, label %vector.ph

.lr.ph.preheader132:                              ; preds = %middle.block, %.lr.ph.preheader
  %indvars.iv104.ph = phi i64 [ %indvars.iv, %.lr.ph.preheader ], [ %ind.end, %middle.block ]
  br label %.lr.ph

vector.ph:                                        ; preds = %.lr.ph.preheader
  %ind.end = add i64 %indvars.iv, %n.vec
  %broadcast.splatinsert = insertelement <4 x i32> poison, i32 %.067, i64 0
  %broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %offset.idx = add i64 %indvars.iv, %index
  %29 = add nsw i64 %offset.idx, 1
  %30 = getelementptr inbounds [210000 x i32], ptr @belong, i64 0, i64 %29
  %31 = getelementptr inbounds i8, ptr %30, i64 16
  store <4 x i32> %broadcast.splat, ptr %30, align 4, !tbaa !5
  store <4 x i32> %broadcast.splat, ptr %31, align 4, !tbaa !5
  %index.next = add nuw i64 %index, 8
  %32 = icmp eq i64 %index.next, %n.vec
  br i1 %32, label %middle.block, label %vector.body, !llvm.loop !9

middle.block:                                     ; preds = %vector.body
  br i1 %cmp.n, label %._crit_edge, label %.lr.ph.preheader132

._crit_edge:                                      ; preds = %.lr.ph, %middle.block, %.lr.ph69
  %33 = add nuw i32 %.067, 1
  %indvars.iv.next = add i64 %indvars.iv, %17
  %indvars.iv.next108 = add i32 %indvars.iv107, %11
  %exitcond109.not = icmp eq i32 %.067, %16
  br i1 %exitcond109.not, label %._crit_edge70, label %.lr.ph69, !llvm.loop !13

.lr.ph:                                           ; preds = %.lr.ph.preheader132, %.lr.ph
  %indvars.iv104 = phi i64 [ %indvars.iv.next105, %.lr.ph ], [ %indvars.iv104.ph, %.lr.ph.preheader132 ]
  %indvars.iv.next105 = add nsw i64 %indvars.iv104, 1
  %34 = getelementptr inbounds [210000 x i32], ptr @belong, i64 0, i64 %indvars.iv.next105
  store i32 %.067, ptr %34, align 4, !tbaa !5
  %lftr.wideiv = trunc i64 %indvars.iv.next105 to i32
  %exitcond.not = icmp eq i32 %indvars.iv107, %lftr.wideiv
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph, !llvm.loop !14

._crit_edge73:                                    ; preds = %49, %._crit_edge70
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #7
  %35 = call ptr @_ZNSt6vectorI5querySaIS0_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %3) #7
  %36 = call ptr @_ZNSt6vectorI5querySaIS0_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %3) #7
  invoke void @_ZSt4sortIN9__gnu_cxx17__normal_iteratorIP5querySt6vectorIS2_SaIS2_EEEEEvT_S8_(ptr %35, ptr %36)
          to label %52 unwind label %56

37:                                               ; preds = %.lr.ph72, %49
  call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %7) #7
  %38 = call noundef nonnull align 4 dereferenceable(20) ptr @_ZNK9__gnu_cxx17__normal_iteratorIP5querySt6vectorIS1_SaIS1_EEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %5) #7
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(20) %7, ptr noundef nonnull align 4 dereferenceable(20) %38, i64 20, i1 false), !tbaa.struct !15
  %39 = load i32, ptr %7, align 4, !tbaa !16
  %40 = icmp eq i32 %39, 0
  br i1 %40, label %41, label %.invoke

41:                                               ; preds = %37
  %42 = call noundef i64 @_ZNKSt6vectorI5querySaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %3) #7
  %43 = trunc i64 %42 to i32
  store i32 %43, ptr %24, align 4, !tbaa !18
  %44 = call noundef i64 @_ZNKSt6vectorI5querySaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %4) #7
  %45 = trunc i64 %44 to i32
  store i32 %45, ptr %25, align 4, !tbaa !19
  br label %.invoke

46:                                               ; preds = %.invoke
  %47 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %7) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #7
  br label %103

.invoke:                                          ; preds = %37, %41
  %48 = phi ptr [ %3, %41 ], [ %4, %37 ]
  invoke void @_ZNSt6vectorI5querySaIS0_EE9push_backERKS0_(ptr noundef nonnull align 8 dereferenceable(24) %48, ptr noundef nonnull align 4 dereferenceable(20) %7)
          to label %49 unwind label %46

49:                                               ; preds = %.invoke
  call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %7) #7
  %50 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIP5querySt6vectorIS1_SaIS1_EEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %5) #7
  %51 = call noundef zeroext i1 @_ZN9__gnu_cxxneIP5querySt6vectorIS1_SaIS1_EEEEbRKNS_17__normal_iteratorIT_T0_EESB_(ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef nonnull align 8 dereferenceable(8) %6) #7
  br i1 %51, label %37, label %._crit_edge73

52:                                               ; preds = %._crit_edge73
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #7
  %53 = call ptr @_ZNSt6vectorI5querySaIS0_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %3) #7
  store ptr %53, ptr %8, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #7
  %54 = call ptr @_ZNSt6vectorI5querySaIS0_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %3) #7
  store ptr %54, ptr %9, align 8
  %55 = call noundef zeroext i1 @_ZN9__gnu_cxxneIP5querySt6vectorIS1_SaIS1_EEEEbRKNS_17__normal_iteratorIT_T0_EESB_(ptr noundef nonnull align 8 dereferenceable(8) %8, ptr noundef nonnull align 8 dereferenceable(8) %9) #7
  br i1 %55, label %.lr.ph97, label %._crit_edge98

._crit_edge98:                                    ; preds = %._crit_edge91, %52
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #7
  call void @_ZNSt6vectorI5querySaIS0_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %4) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %4) #7
  call void @_ZNSt6vectorI5querySaIS0_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %3) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %3) #7
  ret void

56:                                               ; preds = %._crit_edge73
  %57 = landingpad { ptr, i32 }
          cleanup
  br label %103

.lr.ph97:                                         ; preds = %52, %._crit_edge91
  %.04995 = phi i32 [ %.2.lcssa, %._crit_edge91 ], [ 1, %52 ]
  %.05094 = phi i32 [ %.252.lcssa, %._crit_edge91 ], [ 0, %52 ]
  %.05393 = phi i32 [ %.255.lcssa, %._crit_edge91 ], [ 0, %52 ]
  %58 = call noundef nonnull align 4 dereferenceable(20) ptr @_ZNK9__gnu_cxx17__normal_iteratorIP5querySt6vectorIS1_SaIS1_EEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %8) #7
  %.sroa.3.0..sroa_idx = getelementptr inbounds i8, ptr %58, i64 4
  %.sroa.3.0.copyload = load i32, ptr %.sroa.3.0..sroa_idx, align 4, !tbaa !5
  %.sroa.7.0..sroa_idx = getelementptr inbounds i8, ptr %58, i64 8
  %.sroa.7.0.copyload = load i32, ptr %.sroa.7.0..sroa_idx, align 4, !tbaa !5
  %.sroa.11.0..sroa_idx = getelementptr inbounds i8, ptr %58, i64 12
  %.sroa.11.0.copyload = load i32, ptr %.sroa.11.0..sroa_idx, align 4, !tbaa !5
  %.sroa.12.0..sroa_idx = getelementptr inbounds i8, ptr %58, i64 16
  %.sroa.12.0.copyload = load i32, ptr %.sroa.12.0..sroa_idx, align 4, !tbaa !5
  %59 = icmp slt i32 %.04995, %.sroa.3.0.copyload
  br i1 %59, label %.lr.ph76, label %.preheader63

.preheader63:                                     ; preds = %.lr.ph97
  %60 = icmp sgt i32 %.04995, %.sroa.3.0.copyload
  br i1 %60, label %.lr.ph78, label %.preheader62

.lr.ph76:                                         ; preds = %.lr.ph97, %.lr.ph76
  %.174 = phi i32 [ %61, %.lr.ph76 ], [ %.04995, %.lr.ph97 ]
  %61 = add i32 %.174, 1
  call void @_Z3deli(i32 noundef %.174)
  %exitcond110.not = icmp eq i32 %61, %.sroa.3.0.copyload
  br i1 %exitcond110.not, label %.preheader62, label %.lr.ph76, !llvm.loop !20

.preheader62:                                     ; preds = %.lr.ph78, %.lr.ph76, %.preheader63
  %.2.lcssa = phi i32 [ %.04995, %.preheader63 ], [ %.sroa.3.0.copyload, %.lr.ph76 ], [ %.sroa.3.0.copyload, %.lr.ph78 ]
  %62 = icmp slt i32 %.05393, %.sroa.7.0.copyload
  br i1 %62, label %.lr.ph81, label %.preheader61

.lr.ph78:                                         ; preds = %.preheader63, %.lr.ph78
  %.277 = phi i32 [ %63, %.lr.ph78 ], [ %.04995, %.preheader63 ]
  %63 = add nsw i32 %.277, -1
  call void @_Z3addi(i32 noundef %63)
  %64 = icmp sgt i32 %63, %.sroa.3.0.copyload
  br i1 %64, label %.lr.ph78, label %.preheader62, !llvm.loop !21

.preheader61:                                     ; preds = %.preheader62
  %65 = icmp sgt i32 %.05393, %.sroa.7.0.copyload
  br i1 %65, label %.lr.ph84, label %.preheader60

.lr.ph81:                                         ; preds = %.preheader62, %.lr.ph81
  %.15480 = phi i32 [ %66, %.lr.ph81 ], [ %.05393, %.preheader62 ]
  %66 = add nsw i32 %.15480, 1
  call void @_Z3addi(i32 noundef %66)
  %exitcond111.not = icmp eq i32 %66, %.sroa.7.0.copyload
  br i1 %exitcond111.not, label %.preheader60, label %.lr.ph81, !llvm.loop !22

.preheader60:                                     ; preds = %.lr.ph84, %.lr.ph81, %.preheader61
  %.255.lcssa = phi i32 [ %.05393, %.preheader61 ], [ %.sroa.7.0.copyload, %.lr.ph81 ], [ %.sroa.7.0.copyload, %.lr.ph84 ]
  %67 = icmp slt i32 %.05094, %.sroa.12.0.copyload
  br i1 %67, label %.lr.ph87.preheader, label %.preheader

.lr.ph87.preheader:                               ; preds = %.preheader60
  %68 = sext i32 %.05094 to i64
  br label %.lr.ph87

.lr.ph84:                                         ; preds = %.preheader61, %.lr.ph84
  %.25583 = phi i32 [ %69, %.lr.ph84 ], [ %.05393, %.preheader61 ]
  %69 = add nsw i32 %.25583, -1
  call void @_Z3deli(i32 noundef %.25583)
  %70 = icmp sgt i32 %69, %.sroa.7.0.copyload
  br i1 %70, label %.lr.ph84, label %.preheader60, !llvm.loop !23

.preheader:                                       ; preds = %.preheader60
  %71 = icmp sgt i32 %.05094, %.sroa.12.0.copyload
  br i1 %71, label %.lr.ph90.preheader, label %._crit_edge91

.lr.ph90.preheader:                               ; preds = %.preheader
  %72 = sext i32 %.05094 to i64
  %73 = sext i32 %.sroa.12.0.copyload to i64
  br label %.lr.ph90

.lr.ph87:                                         ; preds = %.lr.ph87.preheader, %83
  %indvars.iv112 = phi i64 [ %68, %.lr.ph87.preheader ], [ %indvars.iv.next113, %83 ]
  %74 = call noundef nonnull align 4 dereferenceable(20) ptr @_ZNSt6vectorI5querySaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %indvars.iv112) #7
  %75 = call noundef nonnull align 4 dereferenceable(20) ptr @_ZNSt6vectorI5querySaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %indvars.iv112) #7
  %76 = getelementptr inbounds i8, ptr %75, i64 4
  %77 = load i32, ptr %76, align 4, !tbaa !24
  %.not57 = icmp sgt i32 %.sroa.3.0.copyload, %77
  br i1 %.not57, label %83, label %78

78:                                               ; preds = %.lr.ph87
  %79 = call noundef nonnull align 4 dereferenceable(20) ptr @_ZNSt6vectorI5querySaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %indvars.iv112) #7
  %80 = getelementptr inbounds i8, ptr %79, i64 4
  %81 = load i32, ptr %80, align 4, !tbaa !24
  %82 = icmp sge i32 %.sroa.7.0.copyload, %81
  br label %83

83:                                               ; preds = %78, %.lr.ph87
  %84 = phi i1 [ false, %.lr.ph87 ], [ %82, %78 ]
  call void @_Z6changeR5queryb(ptr noundef nonnull align 4 dereferenceable(20) %74, i1 noundef zeroext %84)
  %indvars.iv.next113 = add nsw i64 %indvars.iv112, 1
  %lftr.wideiv115 = trunc i64 %indvars.iv.next113 to i32
  %exitcond116.not = icmp eq i32 %.sroa.12.0.copyload, %lftr.wideiv115
  br i1 %exitcond116.not, label %._crit_edge91, label %.lr.ph87, !llvm.loop !25

.lr.ph90:                                         ; preds = %.lr.ph90.preheader, %94
  %indvars.iv117 = phi i64 [ %72, %.lr.ph90.preheader ], [ %indvars.iv.next118, %94 ]
  %indvars.iv.next118 = add nsw i64 %indvars.iv117, -1
  %85 = call noundef nonnull align 4 dereferenceable(20) ptr @_ZNSt6vectorI5querySaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %indvars.iv.next118) #7
  %86 = call noundef nonnull align 4 dereferenceable(20) ptr @_ZNSt6vectorI5querySaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %indvars.iv.next118) #7
  %87 = getelementptr inbounds i8, ptr %86, i64 4
  %88 = load i32, ptr %87, align 4, !tbaa !24
  %.not56 = icmp sgt i32 %.sroa.3.0.copyload, %88
  br i1 %.not56, label %94, label %89

89:                                               ; preds = %.lr.ph90
  %90 = call noundef nonnull align 4 dereferenceable(20) ptr @_ZNSt6vectorI5querySaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %indvars.iv.next118) #7
  %91 = getelementptr inbounds i8, ptr %90, i64 4
  %92 = load i32, ptr %91, align 4, !tbaa !24
  %93 = icmp sge i32 %.sroa.7.0.copyload, %92
  br label %94

94:                                               ; preds = %89, %.lr.ph90
  %95 = phi i1 [ false, %.lr.ph90 ], [ %93, %89 ]
  call void @_Z4undoR5queryb(ptr noundef nonnull align 4 dereferenceable(20) %85, i1 noundef zeroext %95)
  %96 = icmp sgt i64 %indvars.iv.next118, %73
  br i1 %96, label %.lr.ph90, label %._crit_edge91.loopexit, !llvm.loop !26

._crit_edge91.loopexit:                           ; preds = %94
  %97 = trunc nsw i64 %indvars.iv.next118 to i32
  br label %._crit_edge91

._crit_edge91:                                    ; preds = %83, %._crit_edge91.loopexit, %.preheader
  %.252.lcssa = phi i32 [ %.05094, %.preheader ], [ %97, %._crit_edge91.loopexit ], [ %.sroa.12.0.copyload, %83 ]
  %98 = call noundef i32 @_Z7get_ansv()
  %99 = sext i32 %.sroa.11.0.copyload to i64
  %100 = getelementptr inbounds [210000 x i32], ptr @ans, i64 0, i64 %99
  store i32 %98, ptr %100, align 4, !tbaa !5
  %101 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIP5querySt6vectorIS1_SaIS1_EEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %8) #7
  %102 = call noundef zeroext i1 @_ZN9__gnu_cxxneIP5querySt6vectorIS1_SaIS1_EEEEbRKNS_17__normal_iteratorIT_T0_EESB_(ptr noundef nonnull align 8 dereferenceable(8) %8, ptr noundef nonnull align 8 dereferenceable(8) %9) #7
  br i1 %102, label %.lr.ph97, label %._crit_edge98

103:                                              ; preds = %56, %46
  %.pn = phi { ptr, i32 } [ %47, %46 ], [ %57, %56 ]
  call void @_ZNSt6vectorI5querySaIS0_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %4) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %4) #7
  call void @_ZNSt6vectorI5querySaIS0_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %3) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %3) #7
  resume { ptr, i32 } %.pn
}

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef double @_ZSt3powIidEN9__gnu_cxx9__promoteIDTplcvNS1_IT_Xsr3std12__is_integerIS2_EE7__valueEE6__typeELi0EcvNS1_IT0_Xsr3std12__is_integerIS5_EE7__valueEE6__typeELi0EEXsr3std12__is_integerIS8_EE7__valueEE6__typeES2_S5_(i32 noundef, double noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.ceil.f64(double) #3

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN9__gnu_cxxneIP5querySt6vectorIS1_SaIS1_EEEEbRKNS_17__normal_iteratorIT_T0_EESB_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(20) ptr @_ZNK9__gnu_cxx17__normal_iteratorIP5querySt6vectorIS1_SaIS1_EEEdeEv(ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #4 align 2

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorI5querySaIS0_EE9push_backERKS0_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 4 dereferenceable(20)) local_unnamed_addr #0 align 2

declare i32 @__gxx_personality_v0(...)

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

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_Z6changeR5queryb(ptr noundef nonnull align 4 dereferenceable(20), i1 noundef zeroext) local_unnamed_addr #2

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_Z4undoR5queryb(ptr noundef nonnull align 4 dereferenceable(20), i1 noundef zeroext) local_unnamed_addr #2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z7get_ansv() local_unnamed_addr #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorI5querySaIS0_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #4 align 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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = { 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, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10, !12, !11}
!15 = !{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}
!16 = !{!17, !6, i64 0}
!17 = !{!"_ZTS5query", !6, i64 0, !6, i64 4, !6, i64 8, !6, i64 12, !6, i64 16}
!18 = !{!17, !6, i64 12}
!19 = !{!17, !6, i64 16}
!20 = distinct !{!20, !10}
!21 = distinct !{!21, !10}
!22 = distinct !{!22, !10}
!23 = distinct !{!23, !10}
!24 = !{!17, !6, i64 4}
!25 = distinct !{!25, !10}
!26 = distinct !{!26, !10}


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