; LLVM IR from tangjz/acm-icpc :: TDL_training/2016-07-08 (C - Graph optimization - tjz)

; 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<int, std::allocator<int>>::_Vector_impl" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::bitset" = type { %"struct.std::_Base_bitset" }
%"struct.std::_Base_bitset" = type { [157 x i64] }
%"class.__gnu_cxx::__normal_iterator" = type { ptr }

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@q = external dso_local global i32, align 4
@seq = external dso_local global [100000 x i32], align 16
@scnt = external dso_local global i32, align 4
@sno = external dso_local global [100000 x i32], align 16
@fin = external dso_local global [100000 x i32], align 16
@e = external dso_local global [100000 x %"class.std::vector"], align 16
@rev = external dso_local global [100000 x %"class.std::vector"], align 16
@query = external dso_local global [100000 x %"class.std::vector"], align 16
@se = external dso_local global [100000 x %"class.std::vector"], align 16
@msk = external dso_local global [100000 x %"class.std::bitset"], align 16
@vis = external dso_local global [100000 x i8], align 16
@.str = external hidden unnamed_addr constant [10 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [2 x i8], align 1
@stdin = external global ptr, align 8
@.str.8 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [2 x i8], align 1
@stdout = external global ptr, align 8
@.str.10 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [7 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z4pfs1i(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: mustprogress nounwind uwtable
declare dso_local ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24)) #2 align 2

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

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

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

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

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #4 {
  %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 %"class.__gnu_cxx::__normal_iterator", align 8
  %10 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %11 = alloca i32, align 4
  %12 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %13 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %14 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %15 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %16 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  %21 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %22 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %23 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %24 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %25 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %26 = alloca i8, align 1
  %27 = alloca i32, align 4
  %28 = alloca i32, align 4
  %29 = alloca i32, align 4
  %30 = alloca i32, align 4
  %31 = alloca i32, align 4
  %32 = alloca i32, align 4
  %33 = alloca i32, align 4
  %34 = alloca i32, align 4
  %35 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %36 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  store i32 0, ptr %1, align 4
  %37 = load ptr, ptr @stdin, align 8, !tbaa !5
  %38 = call ptr @freopen(ptr noundef @.str, ptr noundef @.str.7, ptr noundef %37)
  %39 = load ptr, ptr @stdout, align 8, !tbaa !5
  %40 = call ptr @freopen(ptr noundef @.str.8, ptr noundef @.str.9, ptr noundef %39)
  %41 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.10, ptr noundef @n, ptr noundef @m)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #8
  store i32 0, ptr %2, align 4, !tbaa !9
  br label %42

42:                                               ; preds = %59, %0
  %43 = load i32, ptr %2, align 4, !tbaa !9
  %44 = load i32, ptr @m, align 4, !tbaa !9
  %45 = icmp slt i32 %43, %44
  br i1 %45, label %47, label %46

46:                                               ; preds = %42
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #8
  br label %62

47:                                               ; preds = %42
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #8
  %48 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.10, ptr noundef %3, ptr noundef %4)
  %49 = load i32, ptr %3, align 4, !tbaa !9
  %50 = add nsw i32 %49, -1
  store i32 %50, ptr %3, align 4, !tbaa !9
  %51 = load i32, ptr %4, align 4, !tbaa !9
  %52 = add nsw i32 %51, -1
  store i32 %52, ptr %4, align 4, !tbaa !9
  %53 = load i32, ptr %3, align 4, !tbaa !9
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds [100000 x %"class.std::vector"], ptr @e, i64 0, i64 %54
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %55, ptr noundef nonnull align 4 dereferenceable(4) %4)
  %56 = load i32, ptr %4, align 4, !tbaa !9
  %57 = sext i32 %56 to i64
  %58 = getelementptr inbounds [100000 x %"class.std::vector"], ptr @rev, i64 0, i64 %57
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %58, ptr noundef nonnull align 4 dereferenceable(4) %3)
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #8
  br label %59

59:                                               ; preds = %47
  %60 = load i32, ptr %2, align 4, !tbaa !9
  %61 = add nsw i32 %60, 1
  store i32 %61, ptr %2, align 4, !tbaa !9
  br label %42, !llvm.loop !11

62:                                               ; preds = %46
  store i32 0, ptr @scnt, align 4, !tbaa !9
  %63 = load i32, ptr @n, align 4, !tbaa !9
  %64 = sext i32 %63 to i64
  %65 = mul i64 %64, 1
  call void @llvm.memset.p0.i64(ptr align 16 @vis, i8 0, i64 %65, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #8
  store i32 0, ptr %5, align 4, !tbaa !9
  br label %66

66:                                               ; preds = %80, %62
  %67 = load i32, ptr %5, align 4, !tbaa !9
  %68 = load i32, ptr @n, align 4, !tbaa !9
  %69 = icmp slt i32 %67, %68
  br i1 %69, label %71, label %70

70:                                               ; preds = %66
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #8
  br label %83

71:                                               ; preds = %66
  %72 = load i32, ptr %5, align 4, !tbaa !9
  %73 = sext i32 %72 to i64
  %74 = getelementptr inbounds [100000 x i8], ptr @vis, i64 0, i64 %73
  %75 = load i8, ptr %74, align 1, !tbaa !13, !range !15, !noundef !16
  %76 = trunc i8 %75 to i1
  br i1 %76, label %79, label %77

77:                                               ; preds = %71
  %78 = load i32, ptr %5, align 4, !tbaa !9
  call void @_Z4pfs1i(i32 noundef %78)
  br label %79

79:                                               ; preds = %77, %71
  br label %80

80:                                               ; preds = %79
  %81 = load i32, ptr %5, align 4, !tbaa !9
  %82 = add nsw i32 %81, 1
  store i32 %82, ptr %5, align 4, !tbaa !9
  br label %66, !llvm.loop !17

83:                                               ; preds = %70
  store i32 0, ptr @scnt, align 4, !tbaa !9
  %84 = load i32, ptr @n, align 4, !tbaa !9
  %85 = sext i32 %84 to i64
  %86 = mul i64 %85, 1
  call void @llvm.memset.p0.i64(ptr align 16 @vis, i8 0, i64 %86, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #8
  %87 = load i32, ptr @n, align 4, !tbaa !9
  %88 = sub nsw i32 %87, 1
  store i32 %88, ptr %6, align 4, !tbaa !9
  br label %89

89:                                               ; preds = %110, %83
  %90 = load i32, ptr %6, align 4, !tbaa !9
  %91 = icmp sge i32 %90, 0
  br i1 %91, label %93, label %92

92:                                               ; preds = %89
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #8
  br label %113

93:                                               ; preds = %89
  %94 = load i32, ptr %6, align 4, !tbaa !9
  %95 = sext i32 %94 to i64
  %96 = getelementptr inbounds [100000 x i32], ptr @seq, i64 0, i64 %95
  %97 = load i32, ptr %96, align 4, !tbaa !9
  %98 = sext i32 %97 to i64
  %99 = getelementptr inbounds [100000 x i8], ptr @vis, i64 0, i64 %98
  %100 = load i8, ptr %99, align 1, !tbaa !13, !range !15, !noundef !16
  %101 = trunc i8 %100 to i1
  br i1 %101, label %109, label %102

102:                                              ; preds = %93
  %103 = load i32, ptr %6, align 4, !tbaa !9
  %104 = sext i32 %103 to i64
  %105 = getelementptr inbounds [100000 x i32], ptr @seq, i64 0, i64 %104
  %106 = load i32, ptr %105, align 4, !tbaa !9
  call void @_Z4pfs2i(i32 noundef %106)
  %107 = load i32, ptr @scnt, align 4, !tbaa !9
  %108 = add nsw i32 %107, 1
  store i32 %108, ptr @scnt, align 4, !tbaa !9
  br label %109

109:                                              ; preds = %102, %93
  br label %110

110:                                              ; preds = %109
  %111 = load i32, ptr %6, align 4, !tbaa !9
  %112 = add nsw i32 %111, -1
  store i32 %112, ptr %6, align 4, !tbaa !9
  br label %89, !llvm.loop !18

113:                                              ; preds = %92
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #8
  store i32 0, ptr %7, align 4, !tbaa !9
  br label %114

114:                                              ; preds = %159, %113
  %115 = load i32, ptr %7, align 4, !tbaa !9
  %116 = load i32, ptr @n, align 4, !tbaa !9
  %117 = icmp slt i32 %115, %116
  br i1 %117, label %119, label %118

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

119:                                              ; preds = %114
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #8
  %120 = load i32, ptr %7, align 4, !tbaa !9
  %121 = sext i32 %120 to i64
  %122 = getelementptr inbounds [100000 x %"class.std::vector"], ptr @e, i64 0, i64 %121
  %123 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %122) #8
  %124 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %9, i32 0, i32 0
  store ptr %123, ptr %124, align 8
  br label %125

125:                                              ; preds = %156, %119
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #8
  %126 = load i32, ptr %7, align 4, !tbaa !9
  %127 = sext i32 %126 to i64
  %128 = getelementptr inbounds [100000 x %"class.std::vector"], ptr @e, i64 0, i64 %127
  %129 = call ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %128) #8
  %130 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %10, i32 0, i32 0
  store ptr %129, ptr %130, align 8
  %131 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPiSt6vectorIiSaIiEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %9, ptr noundef nonnull align 8 dereferenceable(8) %10) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #8
  br i1 %131, label %133, label %132

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

133:                                              ; preds = %125
  %134 = load i32, ptr %7, align 4, !tbaa !9
  %135 = sext i32 %134 to i64
  %136 = getelementptr inbounds [100000 x i32], ptr @sno, i64 0, i64 %135
  %137 = load i32, ptr %136, align 4, !tbaa !9
  %138 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %9) #8
  %139 = load i32, ptr %138, align 4, !tbaa !9
  %140 = sext i32 %139 to i64
  %141 = getelementptr inbounds [100000 x i32], ptr @sno, i64 0, i64 %140
  %142 = load i32, ptr %141, align 4, !tbaa !9
  %143 = icmp ne i32 %137, %142
  br i1 %143, label %144, label %155

144:                                              ; preds = %133
  %145 = load i32, ptr %7, align 4, !tbaa !9
  %146 = sext i32 %145 to i64
  %147 = getelementptr inbounds [100000 x i32], ptr @sno, i64 0, i64 %146
  %148 = load i32, ptr %147, align 4, !tbaa !9
  %149 = sext i32 %148 to i64
  %150 = getelementptr inbounds [100000 x %"class.std::vector"], ptr @se, i64 0, i64 %149
  %151 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %9) #8
  %152 = load i32, ptr %151, align 4, !tbaa !9
  %153 = sext i32 %152 to i64
  %154 = getelementptr inbounds [100000 x i32], ptr @sno, i64 0, i64 %153
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %150, ptr noundef nonnull align 4 dereferenceable(4) %154)
  br label %155

155:                                              ; preds = %144, %133
  br label %156

156:                                              ; preds = %155
  %157 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %9) #8
  br label %125, !llvm.loop !19

158:                                              ; preds = %132
  br label %159

159:                                              ; preds = %158
  %160 = load i32, ptr %7, align 4, !tbaa !9
  %161 = add nsw i32 %160, 1
  store i32 %161, ptr %7, align 4, !tbaa !9
  br label %114, !llvm.loop !20

162:                                              ; preds = %118
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #8
  store i32 0, ptr %11, align 4, !tbaa !9
  br label %163

163:                                              ; preds = %199, %162
  %164 = load i32, ptr %11, align 4, !tbaa !9
  %165 = load i32, ptr @scnt, align 4, !tbaa !9
  %166 = icmp slt i32 %164, %165
  br i1 %166, label %168, label %167

167:                                              ; preds = %163
  store i32 17, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #8
  br label %202

168:                                              ; preds = %163
  %169 = load i32, ptr %11, align 4, !tbaa !9
  %170 = sext i32 %169 to i64
  %171 = getelementptr inbounds [100000 x %"class.std::vector"], ptr @se, i64 0, i64 %170
  %172 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %171) #8
  %173 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %12, i32 0, i32 0
  store ptr %172, ptr %173, align 8
  %174 = load i32, ptr %11, align 4, !tbaa !9
  %175 = sext i32 %174 to i64
  %176 = getelementptr inbounds [100000 x %"class.std::vector"], ptr @se, i64 0, i64 %175
  %177 = call ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %176) #8
  %178 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %13, i32 0, i32 0
  store ptr %177, ptr %178, align 8
  %179 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %12, i32 0, i32 0
  %180 = load ptr, ptr %179, align 8
  %181 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %13, i32 0, i32 0
  %182 = load ptr, ptr %181, align 8
  call void @_ZSt4sortIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEEvT_S7_(ptr %180, ptr %182)
  %183 = load i32, ptr %11, align 4, !tbaa !9
  %184 = sext i32 %183 to i64
  %185 = getelementptr inbounds [100000 x %"class.std::vector"], ptr @se, i64 0, i64 %184
  %186 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %185) #8
  %187 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %14, i32 0, i32 0
  store ptr %186, ptr %187, align 8
  %188 = load i32, ptr %11, align 4, !tbaa !9
  %189 = sext i32 %188 to i64
  %190 = getelementptr inbounds [100000 x %"class.std::vector"], ptr @se, i64 0, i64 %189
  %191 = call ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %190) #8
  %192 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %15, i32 0, i32 0
  store ptr %191, ptr %192, align 8
  %193 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %14, i32 0, i32 0
  %194 = load ptr, ptr %193, align 8
  %195 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %15, i32 0, i32 0
  %196 = load ptr, ptr %195, align 8
  %197 = call ptr @_ZSt6uniqueIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEET_S7_S7_(ptr %194, ptr %196)
  %198 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %16, i32 0, i32 0
  store ptr %197, ptr %198, align 8
  br label %199

199:                                              ; preds = %168
  %200 = load i32, ptr %11, align 4, !tbaa !9
  %201 = add nsw i32 %200, 1
  store i32 %201, ptr %11, align 4, !tbaa !9
  br label %163, !llvm.loop !21

202:                                              ; preds = %167
  %203 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.11, ptr noundef @q)
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #8
  store i32 0, ptr %17, align 4, !tbaa !9
  br label %204

204:                                              ; preds = %240, %202
  %205 = load i32, ptr %17, align 4, !tbaa !9
  %206 = load i32, ptr @q, align 4, !tbaa !9
  %207 = icmp slt i32 %205, %206
  br i1 %207, label %209, label %208

208:                                              ; preds = %204
  store i32 20, ptr %8, align 4
  br label %243

209:                                              ; preds = %204
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #8
  %210 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.10, ptr noundef %18, ptr noundef %19)
  %211 = load i32, ptr %18, align 4, !tbaa !9
  %212 = add nsw i32 %211, -1
  store i32 %212, ptr %18, align 4, !tbaa !9
  %213 = load i32, ptr %19, align 4, !tbaa !9
  %214 = add nsw i32 %213, -1
  store i32 %214, ptr %19, align 4, !tbaa !9
  %215 = load i32, ptr %18, align 4, !tbaa !9
  %216 = sext i32 %215 to i64
  %217 = getelementptr inbounds [100000 x i32], ptr @sno, i64 0, i64 %216
  %218 = load i32, ptr %217, align 4, !tbaa !9
  %219 = load i32, ptr %19, align 4, !tbaa !9
  %220 = sext i32 %219 to i64
  %221 = getelementptr inbounds [100000 x i32], ptr @sno, i64 0, i64 %220
  %222 = load i32, ptr %221, align 4, !tbaa !9
  %223 = icmp ne i32 %218, %222
  br i1 %223, label %224, label %234

224:                                              ; preds = %209
  %225 = load i32, ptr %18, align 4, !tbaa !9
  %226 = sext i32 %225 to i64
  %227 = getelementptr inbounds [100000 x i32], ptr @sno, i64 0, i64 %226
  %228 = load i32, ptr %227, align 4, !tbaa !9
  %229 = sext i32 %228 to i64
  %230 = getelementptr inbounds [100000 x %"class.std::vector"], ptr @query, i64 0, i64 %229
  %231 = load i32, ptr %19, align 4, !tbaa !9
  %232 = sext i32 %231 to i64
  %233 = getelementptr inbounds [100000 x i32], ptr @sno, i64 0, i64 %232
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %230, ptr noundef nonnull align 4 dereferenceable(4) %233)
  br label %236

234:                                              ; preds = %209
  %235 = call i32 @puts(ptr noundef @.str.12)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %8, align 4
  br label %237

236:                                              ; preds = %224
  store i32 0, ptr %8, align 4
  br label %237

237:                                              ; preds = %236, %234
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #8
  %238 = load i32, ptr %8, align 4
  switch i32 %238, label %243 [
    i32 0, label %239
  ]

239:                                              ; preds = %237
  br label %240

240:                                              ; preds = %239
  %241 = load i32, ptr %17, align 4, !tbaa !9
  %242 = add nsw i32 %241, 1
  store i32 %242, ptr %17, align 4, !tbaa !9
  br label %204, !llvm.loop !22

243:                                              ; preds = %237, %208
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #8
  %244 = load i32, ptr %8, align 4
  switch i32 %244, label %468 [
    i32 20, label %245
    i32 1, label %466
  ]

245:                                              ; preds = %243
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #8
  store i32 0, ptr %20, align 4, !tbaa !9
  br label %246

246:                                              ; preds = %282, %245
  %247 = load i32, ptr %20, align 4, !tbaa !9
  %248 = load i32, ptr @scnt, align 4, !tbaa !9
  %249 = icmp slt i32 %247, %248
  br i1 %249, label %251, label %250

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

251:                                              ; preds = %246
  %252 = load i32, ptr %20, align 4, !tbaa !9
  %253 = sext i32 %252 to i64
  %254 = getelementptr inbounds [100000 x %"class.std::vector"], ptr @query, i64 0, i64 %253
  %255 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %254) #8
  %256 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %21, i32 0, i32 0
  store ptr %255, ptr %256, align 8
  %257 = load i32, ptr %20, align 4, !tbaa !9
  %258 = sext i32 %257 to i64
  %259 = getelementptr inbounds [100000 x %"class.std::vector"], ptr @query, i64 0, i64 %258
  %260 = call ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %259) #8
  %261 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %22, i32 0, i32 0
  store ptr %260, ptr %261, align 8
  %262 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %21, i32 0, i32 0
  %263 = load ptr, ptr %262, align 8
  %264 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %22, i32 0, i32 0
  %265 = load ptr, ptr %264, align 8
  call void @_ZSt4sortIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEEvT_S7_(ptr %263, ptr %265)
  %266 = load i32, ptr %20, align 4, !tbaa !9
  %267 = sext i32 %266 to i64
  %268 = getelementptr inbounds [100000 x %"class.std::vector"], ptr @query, i64 0, i64 %267
  %269 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %268) #8
  %270 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %23, i32 0, i32 0
  store ptr %269, ptr %270, align 8
  %271 = load i32, ptr %20, align 4, !tbaa !9
  %272 = sext i32 %271 to i64
  %273 = getelementptr inbounds [100000 x %"class.std::vector"], ptr @query, i64 0, i64 %272
  %274 = call ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %273) #8
  %275 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %24, i32 0, i32 0
  store ptr %274, ptr %275, align 8
  %276 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %23, i32 0, i32 0
  %277 = load ptr, ptr %276, align 8
  %278 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %24, i32 0, i32 0
  %279 = load ptr, ptr %278, align 8
  %280 = call ptr @_ZSt6uniqueIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEET_S7_S7_(ptr %277, ptr %279)
  %281 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %25, i32 0, i32 0
  store ptr %280, ptr %281, align 8
  br label %282

282:                                              ; preds = %251
  %283 = load i32, ptr %20, align 4, !tbaa !9
  %284 = add nsw i32 %283, 1
  store i32 %284, ptr %20, align 4, !tbaa !9
  br label %246, !llvm.loop !23

285:                                              ; preds = %250
  call void @llvm.lifetime.start.p0(i64 1, ptr %26) #8
  store i8 1, ptr %26, align 1, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %27) #8
  store i32 0, ptr %27, align 4, !tbaa !9
  br label %286

286:                                              ; preds = %419, %285
  %287 = load i32, ptr %27, align 4, !tbaa !9
  %288 = load i32, ptr @scnt, align 4, !tbaa !9
  %289 = icmp slt i32 %287, %288
  br i1 %289, label %291, label %290

290:                                              ; preds = %286
  store i32 26, ptr %8, align 4
  br label %422

291:                                              ; preds = %286
  call void @llvm.lifetime.start.p0(i64 4, ptr %28) #8
  store i32 0, ptr %28, align 4, !tbaa !9
  br label %292

292:                                              ; preds = %302, %291
  %293 = load i32, ptr %28, align 4, !tbaa !9
  %294 = load i32, ptr @scnt, align 4, !tbaa !9
  %295 = icmp slt i32 %293, %294
  br i1 %295, label %297, label %296

296:                                              ; preds = %292
  store i32 29, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %28) #8
  br label %305

297:                                              ; preds = %292
  %298 = load i32, ptr %28, align 4, !tbaa !9
  %299 = sext i32 %298 to i64
  %300 = getelementptr inbounds [100000 x %"class.std::bitset"], ptr @msk, i64 0, i64 %299
  %301 = call noundef nonnull align 8 dereferenceable(1256) ptr @_ZNSt6bitsetILm10000EE5resetEv(ptr noundef nonnull align 8 dereferenceable(1256) %300) #8
  br label %302

302:                                              ; preds = %297
  %303 = load i32, ptr %28, align 4, !tbaa !9
  %304 = add nsw i32 %303, 1
  store i32 %304, ptr %28, align 4, !tbaa !9
  br label %292, !llvm.loop !24

305:                                              ; preds = %296
  call void @llvm.lifetime.start.p0(i64 4, ptr %29) #8
  store i32 0, ptr %29, align 4, !tbaa !9
  br label %306

306:                                              ; preds = %327, %305
  %307 = load i32, ptr %29, align 4, !tbaa !9
  %308 = icmp slt i32 %307, 10000
  br i1 %308, label %309, label %315

309:                                              ; preds = %306
  %310 = load i32, ptr %27, align 4, !tbaa !9
  %311 = load i32, ptr %29, align 4, !tbaa !9
  %312 = add nsw i32 %310, %311
  %313 = load i32, ptr @scnt, align 4, !tbaa !9
  %314 = icmp slt i32 %312, %313
  br label %315

315:                                              ; preds = %309, %306
  %316 = phi i1 [ false, %306 ], [ %314, %309 ]
  br i1 %316, label %318, label %317

317:                                              ; preds = %315
  store i32 32, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %29) #8
  br label %330

318:                                              ; preds = %315
  %319 = load i32, ptr %27, align 4, !tbaa !9
  %320 = load i32, ptr %29, align 4, !tbaa !9
  %321 = add nsw i32 %319, %320
  %322 = sext i32 %321 to i64
  %323 = getelementptr inbounds [100000 x %"class.std::bitset"], ptr @msk, i64 0, i64 %322
  %324 = load i32, ptr %29, align 4, !tbaa !9
  %325 = sext i32 %324 to i64
  %326 = call noundef nonnull align 8 dereferenceable(1256) ptr @_ZNSt6bitsetILm10000EE3setEmb(ptr noundef nonnull align 8 dereferenceable(1256) %323, i64 noundef %325, i1 noundef zeroext true)
  br label %327

327:                                              ; preds = %318
  %328 = load i32, ptr %29, align 4, !tbaa !9
  %329 = add nsw i32 %328, 1
  store i32 %329, ptr %29, align 4, !tbaa !9
  br label %306, !llvm.loop !25

330:                                              ; preds = %317
  %331 = load i32, ptr @scnt, align 4, !tbaa !9
  %332 = sext i32 %331 to i64
  %333 = mul i64 %332, 1
  call void @llvm.memset.p0.i64(ptr align 16 @vis, i8 0, i64 %333, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %30) #8
  store i32 0, ptr %30, align 4, !tbaa !9
  br label %334

334:                                              ; preds = %348, %330
  %335 = load i32, ptr %30, align 4, !tbaa !9
  %336 = load i32, ptr @scnt, align 4, !tbaa !9
  %337 = icmp slt i32 %335, %336
  br i1 %337, label %339, label %338

338:                                              ; preds = %334
  store i32 35, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %30) #8
  br label %351

339:                                              ; preds = %334
  %340 = load i32, ptr %30, align 4, !tbaa !9
  %341 = sext i32 %340 to i64
  %342 = getelementptr inbounds [100000 x i8], ptr @vis, i64 0, i64 %341
  %343 = load i8, ptr %342, align 1, !tbaa !13, !range !15, !noundef !16
  %344 = trunc i8 %343 to i1
  br i1 %344, label %347, label %345

345:                                              ; preds = %339
  %346 = load i32, ptr %30, align 4, !tbaa !9
  call void @_Z3dfsi(i32 noundef %346)
  br label %347

347:                                              ; preds = %345, %339
  br label %348

348:                                              ; preds = %347
  %349 = load i32, ptr %30, align 4, !tbaa !9
  %350 = add nsw i32 %349, 1
  store i32 %350, ptr %30, align 4, !tbaa !9
  br label %334, !llvm.loop !26

351:                                              ; preds = %338
  call void @llvm.lifetime.start.p0(i64 4, ptr %31) #8
  store i32 0, ptr %31, align 4, !tbaa !9
  br label %352

352:                                              ; preds = %410, %351
  %353 = load i32, ptr %31, align 4, !tbaa !9
  %354 = load i32, ptr @scnt, align 4, !tbaa !9
  %355 = icmp slt i32 %353, %354
  br i1 %355, label %357, label %356

356:                                              ; preds = %352
  store i32 38, ptr %8, align 4
  br label %413

357:                                              ; preds = %352
  call void @llvm.lifetime.start.p0(i64 4, ptr %32) #8
  %358 = load i32, ptr %31, align 4, !tbaa !9
  %359 = sext i32 %358 to i64
  %360 = getelementptr inbounds [100000 x %"class.std::vector"], ptr @query, i64 0, i64 %359
  %361 = call noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %360) #8
  %362 = trunc i64 %361 to i32
  store i32 %362, ptr %32, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %33) #8
  br label %363

363:                                              ; preds = %398, %357
  %364 = load i32, ptr %31, align 4, !tbaa !9
  %365 = sext i32 %364 to i64
  %366 = getelementptr inbounds [100000 x i32], ptr @fin, i64 0, i64 %365
  %367 = load i32, ptr %366, align 4, !tbaa !9
  %368 = load i32, ptr %32, align 4, !tbaa !9
  %369 = icmp slt i32 %367, %368
  br i1 %369, label %370, label %384

370:                                              ; preds = %363
  %371 = load i32, ptr %31, align 4, !tbaa !9
  %372 = sext i32 %371 to i64
  %373 = getelementptr inbounds [100000 x %"class.std::vector"], ptr @query, i64 0, i64 %372
  %374 = load i32, ptr %31, align 4, !tbaa !9
  %375 = sext i32 %374 to i64
  %376 = getelementptr inbounds [100000 x i32], ptr @fin, i64 0, i64 %375
  %377 = load i32, ptr %376, align 4, !tbaa !9
  %378 = sext i32 %377 to i64
  %379 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %373, i64 noundef %378) #8
  %380 = load i32, ptr %379, align 4, !tbaa !9
  store i32 %380, ptr %33, align 4, !tbaa !9
  %381 = load i32, ptr %27, align 4, !tbaa !9
  %382 = add nsw i32 %381, 10000
  %383 = icmp slt i32 %380, %382
  br label %384

384:                                              ; preds = %370, %363
  %385 = phi i1 [ false, %363 ], [ %383, %370 ]
  br i1 %385, label %387, label %386

386:                                              ; preds = %384
  store i32 41, ptr %8, align 4
  br label %404

387:                                              ; preds = %384
  %388 = load i32, ptr %31, align 4, !tbaa !9
  %389 = sext i32 %388 to i64
  %390 = getelementptr inbounds [100000 x %"class.std::bitset"], ptr @msk, i64 0, i64 %389
  %391 = load i32, ptr %33, align 4, !tbaa !9
  %392 = load i32, ptr %27, align 4, !tbaa !9
  %393 = sub nsw i32 %391, %392
  %394 = sext i32 %393 to i64
  %395 = call noundef zeroext i1 @_ZNKSt6bitsetILm10000EE4testEm(ptr noundef nonnull align 8 dereferenceable(1256) %390, i64 noundef %394)
  br i1 %395, label %396, label %397

396:                                              ; preds = %387
  store i8 0, ptr %26, align 1, !tbaa !13
  store i32 41, ptr %8, align 4
  br label %404

397:                                              ; preds = %387
  br label %398

398:                                              ; preds = %397
  %399 = load i32, ptr %31, align 4, !tbaa !9
  %400 = sext i32 %399 to i64
  %401 = getelementptr inbounds [100000 x i32], ptr @fin, i64 0, i64 %400
  %402 = load i32, ptr %401, align 4, !tbaa !9
  %403 = add nsw i32 %402, 1
  store i32 %403, ptr %401, align 4, !tbaa !9
  br label %363, !llvm.loop !27

404:                                              ; preds = %396, %386
  call void @llvm.lifetime.end.p0(i64 4, ptr %33) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %32) #8
  br label %405

405:                                              ; preds = %404
  %406 = load i8, ptr %26, align 1, !tbaa !13, !range !15, !noundef !16
  %407 = trunc i8 %406 to i1
  br i1 %407, label %409, label %408

408:                                              ; preds = %405
  store i32 38, ptr %8, align 4
  br label %413

409:                                              ; preds = %405
  br label %410

410:                                              ; preds = %409
  %411 = load i32, ptr %31, align 4, !tbaa !9
  %412 = add nsw i32 %411, 1
  store i32 %412, ptr %31, align 4, !tbaa !9
  br label %352, !llvm.loop !28

413:                                              ; preds = %408, %356
  call void @llvm.lifetime.end.p0(i64 4, ptr %31) #8
  br label %414

414:                                              ; preds = %413
  %415 = load i8, ptr %26, align 1, !tbaa !13, !range !15, !noundef !16
  %416 = trunc i8 %415 to i1
  br i1 %416, label %418, label %417

417:                                              ; preds = %414
  store i32 26, ptr %8, align 4
  br label %422

418:                                              ; preds = %414
  br label %419

419:                                              ; preds = %418
  %420 = load i32, ptr %27, align 4, !tbaa !9
  %421 = add nsw i32 %420, 10000
  store i32 %421, ptr %27, align 4, !tbaa !9
  br label %286, !llvm.loop !29

422:                                              ; preds = %417, %290
  call void @llvm.lifetime.end.p0(i64 4, ptr %27) #8
  br label %423

423:                                              ; preds = %422
  %424 = load i8, ptr %26, align 1, !tbaa !13, !range !15, !noundef !16
  %425 = trunc i8 %424 to i1
  br i1 %425, label %428, label %426

426:                                              ; preds = %423
  %427 = call i32 @puts(ptr noundef @.str.12)
  br label %465

428:                                              ; preds = %423
  %429 = call i32 @puts(ptr noundef @.str.13)
  %430 = load i32, ptr @m, align 4, !tbaa !9
  %431 = call i32 (ptr, ...) @printf(ptr noundef @.str.14, i32 noundef %430)
  call void @llvm.lifetime.start.p0(i64 4, ptr %34) #8
  store i32 0, ptr %34, align 4, !tbaa !9
  br label %432

432:                                              ; preds = %461, %428
  %433 = load i32, ptr %34, align 4, !tbaa !9
  %434 = load i32, ptr @n, align 4, !tbaa !9
  %435 = icmp slt i32 %433, %434
  br i1 %435, label %437, label %436

436:                                              ; preds = %432
  store i32 44, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %34) #8
  br label %464

437:                                              ; preds = %432
  call void @llvm.lifetime.start.p0(i64 8, ptr %35) #8
  %438 = load i32, ptr %34, align 4, !tbaa !9
  %439 = sext i32 %438 to i64
  %440 = getelementptr inbounds [100000 x %"class.std::vector"], ptr @e, i64 0, i64 %439
  %441 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %440) #8
  %442 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %35, i32 0, i32 0
  store ptr %441, ptr %442, align 8
  br label %443

443:                                              ; preds = %458, %437
  call void @llvm.lifetime.start.p0(i64 8, ptr %36) #8
  %444 = load i32, ptr %34, align 4, !tbaa !9
  %445 = sext i32 %444 to i64
  %446 = getelementptr inbounds [100000 x %"class.std::vector"], ptr @e, i64 0, i64 %445
  %447 = call ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %446) #8
  %448 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %36, i32 0, i32 0
  store ptr %447, ptr %448, align 8
  %449 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPiSt6vectorIiSaIiEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %35, ptr noundef nonnull align 8 dereferenceable(8) %36) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %36) #8
  br i1 %449, label %451, label %450

450:                                              ; preds = %443
  store i32 47, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %35) #8
  br label %460

451:                                              ; preds = %443
  %452 = load i32, ptr %34, align 4, !tbaa !9
  %453 = add nsw i32 %452, 1
  %454 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %35) #8
  %455 = load i32, ptr %454, align 4, !tbaa !9
  %456 = add nsw i32 %455, 1
  %457 = call i32 (ptr, ...) @printf(ptr noundef @.str.15, i32 noundef %453, i32 noundef %456)
  br label %458

458:                                              ; preds = %451
  %459 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %35) #8
  br label %443, !llvm.loop !30

460:                                              ; preds = %450
  br label %461

461:                                              ; preds = %460
  %462 = load i32, ptr %34, align 4, !tbaa !9
  %463 = add nsw i32 %462, 1
  store i32 %463, ptr %34, align 4, !tbaa !9
  br label %432, !llvm.loop !31

464:                                              ; preds = %436
  br label %465

465:                                              ; preds = %464, %426
  store i32 0, ptr %1, align 4
  store i32 1, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 1, ptr %26) #8
  br label %466

466:                                              ; preds = %465, %243
  %467 = load i32, ptr %1, align 4
  ret i32 %467

468:                                              ; preds = %243
  unreachable
}

declare ptr @freopen(ptr noundef, ptr noundef, ptr noundef) #5

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

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local ptr @_ZSt6uniqueIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEET_S7_S7_(ptr, ptr) #7

declare i32 @puts(ptr noundef) #5

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(1256) ptr @_ZNSt6bitsetILm10000EE3setEmb(ptr noundef nonnull align 8 dereferenceable(1256), i64 noundef, i1 noundef zeroext) #0 align 2

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZNKSt6bitsetILm10000EE4testEm(ptr noundef nonnull align 8 dereferenceable(1256), i64 noundef) #0 align 2

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

attributes #0 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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 #5 = { "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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #7 = { 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 #8 = { 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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!14, !14, i64 0}
!14 = !{!"bool", !7, i64 0}
!15 = !{i8 0, i8 2}
!16 = !{}
!17 = distinct !{!17, !12}
!18 = distinct !{!18, !12}
!19 = distinct !{!19, !12}
!20 = distinct !{!20, !12}
!21 = distinct !{!21, !12}
!22 = distinct !{!22, !12}
!23 = distinct !{!23, !12}
!24 = distinct !{!24, !12}
!25 = distinct !{!25, !12}
!26 = distinct !{!26, !12}
!27 = distinct !{!27, !12}
!28 = distinct !{!28, !12}
!29 = distinct !{!29, !12}
!30 = distinct !{!30, !12}
!31 = distinct !{!31, !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<int, std::allocator<int>>::_Vector_impl" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::bitset" = type { %"struct.std::_Base_bitset" }
%"struct.std::_Base_bitset" = type { [157 x i64] }
%"class.__gnu_cxx::__normal_iterator" = type { ptr }

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@q = external dso_local global i32, align 4
@seq = external dso_local local_unnamed_addr global [100000 x i32], align 16
@scnt = external dso_local local_unnamed_addr global i32, align 4
@sno = external dso_local global [100000 x i32], align 16
@fin = external dso_local local_unnamed_addr global [100000 x i32], align 16
@e = external dso_local global [100000 x %"class.std::vector"], align 16
@rev = external dso_local global [100000 x %"class.std::vector"], align 16
@query = external dso_local global [100000 x %"class.std::vector"], align 16
@se = external dso_local global [100000 x %"class.std::vector"], align 16
@msk = external dso_local global [100000 x %"class.std::bitset"], align 16
@vis = external dso_local local_unnamed_addr global [100000 x i8], align 16
@.str = external hidden unnamed_addr constant [10 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [2 x i8], align 1
@stdin = external local_unnamed_addr global ptr, align 8
@.str.8 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [2 x i8], align 1
@stdout = external local_unnamed_addr global ptr, align 8
@.str.10 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [7 x i8], align 1

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

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

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

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

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

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

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

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #4 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %4 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %8 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %9 = load ptr, ptr @stdin, align 8, !tbaa !5
  %10 = tail call ptr @freopen(ptr noundef nonnull @.str, ptr noundef nonnull @.str.7, ptr noundef %9)
  %11 = load ptr, ptr @stdout, align 8, !tbaa !5
  %12 = tail call ptr @freopen(ptr noundef nonnull @.str.8, ptr noundef nonnull @.str.9, ptr noundef %11)
  %13 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.10, ptr noundef nonnull @n, ptr noundef nonnull @m)
  %14 = load i32, ptr @m, align 4, !tbaa !9
  %15 = icmp sgt i32 %14, 0
  br i1 %15, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %0
  store i32 0, ptr @scnt, align 4, !tbaa !9
  %16 = load i32, ptr @n, align 4, !tbaa !9
  %17 = sext i32 %16 to i64
  call void @llvm.memset.p0.i64(ptr nonnull align 16 @vis, i8 0, i64 %17, i1 false)
  %18 = icmp sgt i32 %16, 0
  br i1 %18, label %.lr.ph121, label %._crit_edge122.thread

._crit_edge122.thread:                            ; preds = %._crit_edge
  store i32 0, ptr @scnt, align 4, !tbaa !9
  call void @llvm.memset.p0.i64(ptr nonnull align 16 @vis, i8 0, i64 %17, i1 false)
  br label %._crit_edge134

.lr.ph:                                           ; preds = %0, %.lr.ph
  %.081118 = phi i32 [ %29, %.lr.ph ], [ 0, %0 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #9
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #9
  %19 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.10, ptr noundef nonnull %1, ptr noundef nonnull %2)
  %20 = load i32, ptr %1, align 4, !tbaa !9
  %21 = add nsw i32 %20, -1
  store i32 %21, ptr %1, align 4, !tbaa !9
  %22 = load i32, ptr %2, align 4, !tbaa !9
  %23 = add nsw i32 %22, -1
  store i32 %23, ptr %2, align 4, !tbaa !9
  %24 = sext i32 %21 to i64
  %25 = getelementptr inbounds [100000 x %"class.std::vector"], ptr @e, i64 0, i64 %24
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %25, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %26 = load i32, ptr %2, align 4, !tbaa !9
  %27 = sext i32 %26 to i64
  %28 = getelementptr inbounds [100000 x %"class.std::vector"], ptr @rev, i64 0, i64 %27
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %28, ptr noundef nonnull align 4 dereferenceable(4) %1)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #9
  %29 = add nuw nsw i32 %.081118, 1
  %30 = load i32, ptr @m, align 4, !tbaa !9
  %31 = icmp slt i32 %29, %30
  br i1 %31, label %.lr.ph, label %._crit_edge, !llvm.loop !11

._crit_edge122:                                   ; preds = %40
  store i32 0, ptr @scnt, align 4, !tbaa !9
  call void @llvm.memset.p0.i64(ptr nonnull align 16 @vis, i8 0, i64 %42, i1 false)
  %32 = icmp sgt i32 %41, 0
  br i1 %32, label %.lr.ph126.preheader, label %._crit_edge134

.lr.ph126.preheader:                              ; preds = %._crit_edge122
  %33 = zext nneg i32 %41 to i64
  br label %.lr.ph126

.lr.ph121:                                        ; preds = %._crit_edge, %40
  %34 = phi i32 [ %41, %40 ], [ %16, %._crit_edge ]
  %indvars.iv = phi i64 [ %indvars.iv.next, %40 ], [ 0, %._crit_edge ]
  %35 = getelementptr inbounds [100000 x i8], ptr @vis, i64 0, i64 %indvars.iv
  %36 = load i8, ptr %35, align 1, !tbaa !13, !range !15, !noundef !16
  %37 = trunc nuw i8 %36 to i1
  br i1 %37, label %40, label %38

38:                                               ; preds = %.lr.ph121
  %39 = trunc nuw nsw i64 %indvars.iv to i32
  call void @_Z4pfs1i(i32 noundef %39)
  %.pre = load i32, ptr @n, align 4, !tbaa !9
  br label %40

40:                                               ; preds = %.lr.ph121, %38
  %41 = phi i32 [ %34, %.lr.ph121 ], [ %.pre, %38 ]
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %42 = sext i32 %41 to i64
  %43 = icmp slt i64 %indvars.iv.next, %42
  br i1 %43, label %.lr.ph121, label %._crit_edge122, !llvm.loop !17

.preheader117:                                    ; preds = %55
  %.pre191 = load i32, ptr @n, align 4, !tbaa !9
  %44 = icmp sgt i32 %.pre191, 0
  br i1 %44, label %.lr.ph131, label %.preheader116

.lr.ph126:                                        ; preds = %.lr.ph126.preheader, %55
  %45 = phi i32 [ 0, %.lr.ph126.preheader ], [ %56, %55 ]
  %indvars.iv161 = phi i64 [ %33, %.lr.ph126.preheader ], [ %indvars.iv.next162, %55 ]
  %indvars.iv.next162 = add nsw i64 %indvars.iv161, -1
  %46 = getelementptr inbounds [100000 x i32], ptr @seq, i64 0, i64 %indvars.iv.next162
  %47 = load i32, ptr %46, align 4, !tbaa !9
  %48 = sext i32 %47 to i64
  %49 = getelementptr inbounds [100000 x i8], ptr @vis, i64 0, i64 %48
  %50 = load i8, ptr %49, align 1, !tbaa !13, !range !15, !noundef !16
  %51 = trunc nuw i8 %50 to i1
  br i1 %51, label %55, label %52

52:                                               ; preds = %.lr.ph126
  call void @_Z4pfs2i(i32 noundef %47)
  %53 = load i32, ptr @scnt, align 4, !tbaa !9
  %54 = add nsw i32 %53, 1
  store i32 %54, ptr @scnt, align 4, !tbaa !9
  br label %55

55:                                               ; preds = %.lr.ph126, %52
  %56 = phi i32 [ %45, %.lr.ph126 ], [ %54, %52 ]
  %57 = icmp ugt i64 %indvars.iv161, 1
  br i1 %57, label %.lr.ph126, label %.preheader117, !llvm.loop !18

.preheader116.loopexit:                           ; preds = %._crit_edge129
  %.pre192 = load i32, ptr @scnt, align 4, !tbaa !9
  br label %.preheader116

.preheader116:                                    ; preds = %.preheader116.loopexit, %.preheader117
  %58 = phi i32 [ %.pre192, %.preheader116.loopexit ], [ %56, %.preheader117 ]
  %59 = icmp sgt i32 %58, 0
  br i1 %59, label %.lr.ph133, label %._crit_edge134

.lr.ph131:                                        ; preds = %.preheader117, %._crit_edge129
  %indvars.iv164 = phi i64 [ %indvars.iv.next165, %._crit_edge129 ], [ 0, %.preheader117 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #9
  %60 = getelementptr inbounds [100000 x %"class.std::vector"], ptr @e, i64 0, i64 %indvars.iv164
  %61 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %60) #9
  store ptr %61, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #9
  %62 = call ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %60) #9
  store ptr %62, ptr %4, align 8
  %63 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPiSt6vectorIiSaIiEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 8 dereferenceable(8) %4) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #9
  br i1 %63, label %.lr.ph128, label %._crit_edge129

.lr.ph128:                                        ; preds = %.lr.ph131
  %64 = getelementptr inbounds [100000 x i32], ptr @sno, i64 0, i64 %indvars.iv164
  br label %68

._crit_edge129:                                   ; preds = %83, %.lr.ph131
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #9
  %indvars.iv.next165 = add nuw nsw i64 %indvars.iv164, 1
  %65 = load i32, ptr @n, align 4, !tbaa !9
  %66 = sext i32 %65 to i64
  %67 = icmp slt i64 %indvars.iv.next165, %66
  br i1 %67, label %.lr.ph131, label %.preheader116.loopexit, !llvm.loop !19

68:                                               ; preds = %.lr.ph128, %83
  %69 = load i32, ptr %64, align 4, !tbaa !9
  %70 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %3) #9
  %71 = load i32, ptr %70, align 4, !tbaa !9
  %72 = sext i32 %71 to i64
  %73 = getelementptr inbounds [100000 x i32], ptr @sno, i64 0, i64 %72
  %74 = load i32, ptr %73, align 4, !tbaa !9
  %.not = icmp eq i32 %69, %74
  br i1 %.not, label %83, label %75

75:                                               ; preds = %68
  %76 = load i32, ptr %64, align 4, !tbaa !9
  %77 = sext i32 %76 to i64
  %78 = getelementptr inbounds [100000 x %"class.std::vector"], ptr @se, i64 0, i64 %77
  %79 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %3) #9
  %80 = load i32, ptr %79, align 4, !tbaa !9
  %81 = sext i32 %80 to i64
  %82 = getelementptr inbounds [100000 x i32], ptr @sno, i64 0, i64 %81
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %78, ptr noundef nonnull align 4 dereferenceable(4) %82)
  br label %83

83:                                               ; preds = %68, %75
  %84 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %3) #9
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #9
  %85 = call ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %60) #9
  store ptr %85, ptr %4, align 8
  %86 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPiSt6vectorIiSaIiEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 8 dereferenceable(8) %4) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #9
  br i1 %86, label %68, label %._crit_edge129, !llvm.loop !20

._crit_edge134:                                   ; preds = %.lr.ph133, %._crit_edge122, %._crit_edge122.thread, %.preheader116
  %87 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.11, ptr noundef nonnull @q)
  %88 = load i32, ptr @q, align 4, !tbaa !9
  %89 = icmp sgt i32 %88, 0
  br i1 %89, label %.lr.ph137, label %.preheader115

.lr.ph133:                                        ; preds = %.preheader116, %.lr.ph133
  %indvars.iv167 = phi i64 [ %indvars.iv.next168, %.lr.ph133 ], [ 0, %.preheader116 ]
  %90 = getelementptr inbounds [100000 x %"class.std::vector"], ptr @se, i64 0, i64 %indvars.iv167
  %91 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %90) #9
  %92 = call ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %90) #9
  call void @_ZSt4sortIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEEvT_S7_(ptr %91, ptr %92)
  %93 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %90) #9
  %94 = call ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %90) #9
  %95 = call ptr @_ZSt6uniqueIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEET_S7_S7_(ptr %93, ptr %94)
  %indvars.iv.next168 = add nuw nsw i64 %indvars.iv167, 1
  %96 = load i32, ptr @scnt, align 4, !tbaa !9
  %97 = sext i32 %96 to i64
  %98 = icmp slt i64 %indvars.iv.next168, %97
  br i1 %98, label %.lr.ph133, label %._crit_edge134, !llvm.loop !21

.preheader115:                                    ; preds = %113, %._crit_edge134
  %99 = load i32, ptr @scnt, align 4, !tbaa !9
  %100 = icmp sgt i32 %99, 0
  br i1 %100, label %.lr.ph139, label %._crit_edge152

.lr.ph137:                                        ; preds = %._crit_edge134, %113
  %.098135 = phi i32 [ %116, %113 ], [ 0, %._crit_edge134 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #9
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #9
  %101 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.10, ptr noundef nonnull %5, ptr noundef nonnull %6)
  %102 = load i32, ptr %5, align 4, !tbaa !9
  %103 = add nsw i32 %102, -1
  store i32 %103, ptr %5, align 4, !tbaa !9
  %104 = load i32, ptr %6, align 4, !tbaa !9
  %105 = add nsw i32 %104, -1
  store i32 %105, ptr %6, align 4, !tbaa !9
  %106 = sext i32 %103 to i64
  %107 = getelementptr inbounds [100000 x i32], ptr @sno, i64 0, i64 %106
  %108 = load i32, ptr %107, align 4, !tbaa !9
  %109 = sext i32 %105 to i64
  %110 = getelementptr inbounds [100000 x i32], ptr @sno, i64 0, i64 %109
  %111 = load i32, ptr %110, align 4, !tbaa !9
  %.not.not = icmp eq i32 %108, %111
  br i1 %.not.not, label %.thread103, label %113

.thread103:                                       ; preds = %.lr.ph137
  %112 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.12)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #9
  br label %.loopexit

113:                                              ; preds = %.lr.ph137
  %114 = sext i32 %108 to i64
  %115 = getelementptr inbounds [100000 x %"class.std::vector"], ptr @query, i64 0, i64 %114
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %115, ptr noundef nonnull align 4 dereferenceable(4) %110)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #9
  %116 = add nuw nsw i32 %.098135, 1
  %117 = load i32, ptr @q, align 4, !tbaa !9
  %118 = icmp slt i32 %116, %117
  br i1 %118, label %.lr.ph137, label %.preheader115, !llvm.loop !22

.preheader114:                                    ; preds = %.lr.ph139
  %119 = icmp sgt i32 %126, 0
  br i1 %119, label %.preheader113, label %._crit_edge152

.lr.ph139:                                        ; preds = %.preheader115, %.lr.ph139
  %indvars.iv170 = phi i64 [ %indvars.iv.next171, %.lr.ph139 ], [ 0, %.preheader115 ]
  %120 = getelementptr inbounds [100000 x %"class.std::vector"], ptr @query, i64 0, i64 %indvars.iv170
  %121 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %120) #9
  %122 = call ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %120) #9
  call void @_ZSt4sortIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEEvT_S7_(ptr %121, ptr %122)
  %123 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %120) #9
  %124 = call ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %120) #9
  %125 = call ptr @_ZSt6uniqueIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEET_S7_S7_(ptr %123, ptr %124)
  %indvars.iv.next171 = add nuw nsw i64 %indvars.iv170, 1
  %126 = load i32, ptr @scnt, align 4, !tbaa !9
  %127 = sext i32 %126 to i64
  %128 = icmp slt i64 %indvars.iv.next171, %127
  br i1 %128, label %.lr.ph139, label %.preheader114, !llvm.loop !23

.preheader113:                                    ; preds = %.preheader114, %._crit_edge150
  %129 = phi i32 [ %185, %._crit_edge150 ], [ %126, %.preheader114 ]
  %indvars.iv185 = phi i64 [ %indvars.iv.next186.pre-phi, %._crit_edge150 ], [ 0, %.preheader114 ]
  %130 = icmp sgt i32 %129, 0
  br i1 %130, label %.lr.ph141, label %.preheader112.preheader

.lr.ph141:                                        ; preds = %.preheader113, %.lr.ph141
  %indvars.iv173 = phi i64 [ %indvars.iv.next174, %.lr.ph141 ], [ 0, %.preheader113 ]
  %131 = getelementptr inbounds [100000 x %"class.std::bitset"], ptr @msk, i64 0, i64 %indvars.iv173
  %132 = call noundef nonnull align 8 dereferenceable(1256) ptr @_ZNSt6bitsetILm10000EE5resetEv(ptr noundef nonnull align 8 dereferenceable(1256) %131) #9
  %indvars.iv.next174 = add nuw nsw i64 %indvars.iv173, 1
  %133 = load i32, ptr @scnt, align 4, !tbaa !9
  %134 = sext i32 %133 to i64
  %135 = icmp slt i64 %indvars.iv.next174, %134
  br i1 %135, label %.lr.ph141, label %.preheader112.preheader, !llvm.loop !24

.preheader112.preheader:                          ; preds = %.lr.ph141, %.preheader113
  br label %.preheader112

.preheader112:                                    ; preds = %.preheader112.preheader, %142
  %indvars.iv176 = phi i64 [ %indvars.iv.next177, %142 ], [ 0, %.preheader112.preheader ]
  %136 = add nuw nsw i64 %indvars.iv176, %indvars.iv185
  %137 = load i32, ptr @scnt, align 4, !tbaa !9
  %138 = sext i32 %137 to i64
  %139 = icmp slt i64 %136, %138
  br i1 %139, label %142, label %.critedge

.critedge:                                        ; preds = %.preheader112, %..critedge_crit_edge
  %.pre-phi196 = phi i64 [ %.pre195, %..critedge_crit_edge ], [ %138, %.preheader112 ]
  %140 = phi i32 [ %.pre193, %..critedge_crit_edge ], [ %137, %.preheader112 ]
  call void @llvm.memset.p0.i64(ptr nonnull align 16 @vis, i8 0, i64 %.pre-phi196, i1 false)
  %141 = icmp sgt i32 %140, 0
  br i1 %141, label %.lr.ph144, label %.preheader.._crit_edge150_crit_edge

142:                                              ; preds = %.preheader112
  %143 = getelementptr inbounds [100000 x %"class.std::bitset"], ptr @msk, i64 0, i64 %136
  %144 = call noundef nonnull align 8 dereferenceable(1256) ptr @_ZNSt6bitsetILm10000EE3setEmb(ptr noundef nonnull align 8 dereferenceable(1256) %143, i64 noundef %indvars.iv176, i1 noundef zeroext true)
  %indvars.iv.next177 = add nuw nsw i64 %indvars.iv176, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next177, 10000
  br i1 %exitcond.not, label %..critedge_crit_edge, label %.preheader112, !llvm.loop !25

..critedge_crit_edge:                             ; preds = %142
  %.pre193 = load i32, ptr @scnt, align 4, !tbaa !9
  %.pre195 = sext i32 %.pre193 to i64
  br label %.critedge

.preheader:                                       ; preds = %156
  %145 = icmp sgt i32 %157, 0
  br i1 %145, label %.lr.ph149, label %.preheader.._crit_edge150_crit_edge

.preheader.._crit_edge150_crit_edge:              ; preds = %.critedge, %.preheader
  %146 = phi i32 [ %157, %.preheader ], [ %140, %.critedge ]
  %.pre197 = add nuw nsw i64 %indvars.iv185, 10000
  br label %._crit_edge150

.lr.ph149:                                        ; preds = %.preheader
  %147 = add nuw nsw i64 %indvars.iv185, 10000
  %148 = trunc nuw i64 %147 to i32
  %149 = trunc nuw nsw i64 %indvars.iv185 to i32
  br label %160

.lr.ph144:                                        ; preds = %.critedge, %156
  %150 = phi i32 [ %157, %156 ], [ %140, %.critedge ]
  %indvars.iv179 = phi i64 [ %indvars.iv.next180, %156 ], [ 0, %.critedge ]
  %151 = getelementptr inbounds [100000 x i8], ptr @vis, i64 0, i64 %indvars.iv179
  %152 = load i8, ptr %151, align 1, !tbaa !13, !range !15, !noundef !16
  %153 = trunc nuw i8 %152 to i1
  br i1 %153, label %156, label %154

154:                                              ; preds = %.lr.ph144
  %155 = trunc nuw nsw i64 %indvars.iv179 to i32
  call void @_Z3dfsi(i32 noundef %155)
  %.pre194 = load i32, ptr @scnt, align 4, !tbaa !9
  br label %156

156:                                              ; preds = %.lr.ph144, %154
  %157 = phi i32 [ %150, %.lr.ph144 ], [ %.pre194, %154 ]
  %indvars.iv.next180 = add nuw nsw i64 %indvars.iv179, 1
  %158 = sext i32 %157 to i64
  %159 = icmp slt i64 %indvars.iv.next180, %158
  br i1 %159, label %.lr.ph144, label %.preheader, !llvm.loop !26

160:                                              ; preds = %.lr.ph149, %.critedge2
  %indvars.iv182 = phi i64 [ 0, %.lr.ph149 ], [ %indvars.iv.next183, %.critedge2 ]
  %161 = getelementptr inbounds [100000 x %"class.std::vector"], ptr @query, i64 0, i64 %indvars.iv182
  %162 = call noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %161) #9
  %163 = trunc i64 %162 to i32
  %164 = getelementptr inbounds [100000 x i32], ptr @fin, i64 0, i64 %indvars.iv182
  %165 = load i32, ptr %164, align 4, !tbaa !9
  %166 = icmp slt i32 %165, %163
  br i1 %166, label %.lr.ph146, label %.critedge2

.lr.ph146:                                        ; preds = %160
  %167 = getelementptr inbounds [100000 x %"class.std::bitset"], ptr @msk, i64 0, i64 %indvars.iv182
  br label %168

168:                                              ; preds = %.lr.ph146, %178
  %169 = phi i32 [ %165, %.lr.ph146 ], [ %180, %178 ]
  %170 = sext i32 %169 to i64
  %171 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %161, i64 noundef %170) #9
  %172 = load i32, ptr %171, align 4, !tbaa !9
  %173 = icmp slt i32 %172, %148
  br i1 %173, label %174, label %.critedge2

174:                                              ; preds = %168
  %175 = sub nsw i32 %172, %149
  %176 = sext i32 %175 to i64
  %177 = call noundef zeroext i1 @_ZNKSt6bitsetILm10000EE4testEm(ptr noundef nonnull align 8 dereferenceable(1256) %167, i64 noundef %176)
  br i1 %177, label %.thread110, label %178

178:                                              ; preds = %174
  %179 = load i32, ptr %164, align 4, !tbaa !9
  %180 = add nsw i32 %179, 1
  store i32 %180, ptr %164, align 4, !tbaa !9
  %181 = icmp slt i32 %180, %163
  br i1 %181, label %168, label %.critedge2, !llvm.loop !27

.critedge2:                                       ; preds = %168, %178, %160
  %indvars.iv.next183 = add nuw nsw i64 %indvars.iv182, 1
  %182 = load i32, ptr @scnt, align 4, !tbaa !9
  %183 = sext i32 %182 to i64
  %184 = icmp slt i64 %indvars.iv.next183, %183
  br i1 %184, label %160, label %._crit_edge150, !llvm.loop !28

._crit_edge150:                                   ; preds = %.critedge2, %.preheader.._crit_edge150_crit_edge
  %indvars.iv.next186.pre-phi = phi i64 [ %.pre197, %.preheader.._crit_edge150_crit_edge ], [ %147, %.critedge2 ]
  %185 = phi i32 [ %146, %.preheader.._crit_edge150_crit_edge ], [ %182, %.critedge2 ]
  %186 = trunc nuw i64 %indvars.iv.next186.pre-phi to i32
  %187 = icmp sgt i32 %185, %186
  br i1 %187, label %.preheader113, label %._crit_edge152, !llvm.loop !29

.thread110:                                       ; preds = %174
  %188 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.12)
  br label %.loopexit

._crit_edge152:                                   ; preds = %._crit_edge150, %.preheader115, %.preheader114
  %189 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.13)
  %190 = load i32, ptr @m, align 4, !tbaa !9
  %191 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.14, i32 noundef %190)
  %192 = load i32, ptr @n, align 4, !tbaa !9
  %193 = icmp sgt i32 %192, 0
  br i1 %193, label %.lr.ph158, label %.loopexit

.lr.ph158:                                        ; preds = %._crit_edge152, %._crit_edge155
  %indvars.iv188 = phi i64 [ %198, %._crit_edge155 ], [ 0, %._crit_edge152 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #9
  %194 = getelementptr inbounds [100000 x %"class.std::vector"], ptr @e, i64 0, i64 %indvars.iv188
  %195 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %194) #9
  store ptr %195, ptr %7, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #9
  %196 = call ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %194) #9
  store ptr %196, ptr %8, align 8
  %197 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPiSt6vectorIiSaIiEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %7, ptr noundef nonnull align 8 dereferenceable(8) %8) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #9
  %198 = add nuw nsw i64 %indvars.iv188, 1
  br i1 %197, label %.lr.ph154, label %._crit_edge155

.lr.ph154:                                        ; preds = %.lr.ph158
  %199 = trunc nuw nsw i64 %198 to i32
  br label %203

._crit_edge155:                                   ; preds = %203, %.lr.ph158
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #9
  %200 = load i32, ptr @n, align 4, !tbaa !9
  %201 = sext i32 %200 to i64
  %202 = icmp slt i64 %198, %201
  br i1 %202, label %.lr.ph158, label %.loopexit, !llvm.loop !30

203:                                              ; preds = %.lr.ph154, %203
  %204 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %7) #9
  %205 = load i32, ptr %204, align 4, !tbaa !9
  %206 = add nsw i32 %205, 1
  %207 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.15, i32 noundef %199, i32 noundef %206)
  %208 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %7) #9
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #9
  %209 = call ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %194) #9
  store ptr %209, ptr %8, align 8
  %210 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPiSt6vectorIiSaIiEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %7, ptr noundef nonnull align 8 dereferenceable(8) %8) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #9
  br i1 %210, label %203, label %._crit_edge155, !llvm.loop !31

.loopexit:                                        ; preds = %._crit_edge155, %._crit_edge152, %.thread103, %.thread110
  ret i32 0
}

declare ptr @freopen(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #5

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

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local ptr @_ZSt6uniqueIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEET_S7_S7_(ptr, ptr) local_unnamed_addr #8

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(1256) ptr @_ZNSt6bitsetILm10000EE3setEmb(ptr noundef nonnull align 8 dereferenceable(1256), i64 noundef, i1 noundef zeroext) local_unnamed_addr #0 align 2

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZNKSt6bitsetILm10000EE4testEm(ptr noundef nonnull align 8 dereferenceable(1256), i64 noundef) local_unnamed_addr #0 align 2

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

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

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

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


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