; LLVM IR from tangjz/acm-icpc :: codeforces/gym (100540E)

; 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::map" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<int, std::pair<const int, int>, std::_Select1st<std::pair<const int, int>>, std::less<int>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<int, std::pair<const int, int>, std::_Select1st<std::pair<const int, int>>, std::less<int>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"struct.std::pair" = type { i32, i32 }
%"class.__gnu_cxx::__normal_iterator" = type { ptr }

@Hash = external dso_local global %"class.std::map", align 8
@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@q = external dso_local global i32, align 4
@pos = external dso_local global [20001 x i32], align 16
@a = external dso_local global [20001 x i32], align 16
@b = external dso_local global [20001 x i32], align 16
@que = external dso_local global [20001 x i32], align 16
@L = external dso_local global i32, align 4
@R = external dso_local global i32, align 4
@e = external dso_local global [20001 x %"class.std::vector"], align 16
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [3 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEEC2Ev(ptr noundef nonnull align 8 dereferenceable(48)) unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEED2Ev(ptr noundef nonnull align 8 dereferenceable(48)) unnamed_addr #0 align 2

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #1 {
  %1 = alloca i32, align 4
  %2 = alloca %"class.std::map", align 8
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca %"struct.std::pair", align 4
  %7 = alloca %"struct.std::pair", align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %14 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  %21 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  br label %22

22:                                               ; preds = %399, %0
  %23 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @m, ptr noundef @q)
  %24 = icmp eq i32 %23, 2
  br i1 %24, label %25, label %30

25:                                               ; preds = %22
  %26 = load i32, ptr @m, align 4, !tbaa !5
  %27 = load i32, ptr @q, align 4, !tbaa !5
  %28 = add nsw i32 %26, %27
  %29 = icmp ne i32 %28, 0
  br label %30

30:                                               ; preds = %25, %22
  %31 = phi i1 [ false, %22 ], [ %29, %25 ]
  br i1 %31, label %32, label %402

32:                                               ; preds = %30
  store i32 0, ptr @n, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 48, ptr %2) #8
  call void @llvm.memset.p0.i64(ptr align 8 %2, i8 0, i64 48, i1 false)
  call void @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEEC2Ev(ptr noundef nonnull align 8 dereferenceable(48) %2) #8
  call void @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEE4swapERS6_(ptr noundef nonnull align 8 dereferenceable(48) %2, ptr noundef nonnull align 8 dereferenceable(48) @Hash) #8
  call void @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %2) #8
  call void @llvm.lifetime.end.p0(i64 48, ptr %2) #8
  br label %33

33:                                               ; preds = %49, %32
  %34 = load i32, ptr @m, align 4, !tbaa !5
  %35 = add nsw i32 %34, -1
  store i32 %35, ptr @m, align 4, !tbaa !5
  %36 = icmp ne i32 %34, 0
  br i1 %36, label %37, label %58

37:                                               ; preds = %33
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #8
  %38 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.2, ptr noundef %3, ptr noundef %4, ptr noundef %5)
  %39 = load i32, ptr %3, align 4, !tbaa !5
  %40 = call noundef i32 @_Z5getIDi(i32 noundef %39)
  store i32 %40, ptr %3, align 4, !tbaa !5
  %41 = load i32, ptr %4, align 4, !tbaa !5
  %42 = call noundef i32 @_Z5getIDi(i32 noundef %41)
  store i32 %42, ptr %4, align 4, !tbaa !5
  %43 = load i32, ptr %3, align 4, !tbaa !5
  %44 = load i32, ptr %4, align 4, !tbaa !5
  %45 = icmp eq i32 %43, %44
  br i1 %45, label %46, label %49

46:                                               ; preds = %37
  %47 = load i32, ptr %5, align 4, !tbaa !5
  %48 = shl i32 %47, 1
  store i32 %48, ptr %5, align 4, !tbaa !5
  br label %49

49:                                               ; preds = %46, %37
  %50 = load i32, ptr %3, align 4, !tbaa !5
  %51 = sext i32 %50 to i64
  %52 = getelementptr inbounds [20001 x %"class.std::vector"], ptr @e, i64 0, i64 %51
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #8
  %53 = call i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %4, ptr noundef nonnull align 4 dereferenceable(4) %5)
  store i64 %53, ptr %6, align 4
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24) %52, ptr noundef nonnull align 4 dereferenceable(8) %6)
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #8
  %54 = load i32, ptr %4, align 4, !tbaa !5
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds [20001 x %"class.std::vector"], ptr @e, i64 0, i64 %55
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #8
  %57 = call i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %3, ptr noundef nonnull align 4 dereferenceable(4) %5)
  store i64 %57, ptr %7, align 4
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24) %56, ptr noundef nonnull align 4 dereferenceable(8) %7)
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #8
  br label %33, !llvm.loop !9

58:                                               ; preds = %33
  %59 = load i32, ptr @n, align 4, !tbaa !5
  %60 = sext i32 %59 to i64
  %61 = mul i64 %60, 4
  call void @llvm.memset.p0.i64(ptr align 16 @pos, i8 0, i64 %61, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #8
  store i32 0, ptr %8, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #8
  store i32 0, ptr %9, align 4, !tbaa !5
  br label %62

62:                                               ; preds = %303, %58
  %63 = load i32, ptr %8, align 4, !tbaa !5
  %64 = load i32, ptr @n, align 4, !tbaa !5
  %65 = icmp slt i32 %63, %64
  br i1 %65, label %67, label %66

66:                                               ; preds = %62
  store i32 6, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #8
  br label %306

67:                                               ; preds = %62
  %68 = load i32, ptr %8, align 4, !tbaa !5
  %69 = sext i32 %68 to i64
  %70 = getelementptr inbounds [20001 x i32], ptr @pos, i64 0, i64 %69
  %71 = load i32, ptr %70, align 4, !tbaa !5
  %72 = icmp ne i32 %71, 0
  br i1 %72, label %73, label %74

73:                                               ; preds = %67
  br label %303

74:                                               ; preds = %67
  %75 = load i32, ptr %9, align 4, !tbaa !5
  %76 = add nsw i32 %75, 1
  store i32 %76, ptr %9, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #8
  store i32 1061109567, ptr %11, align 4, !tbaa !5
  store i32 0, ptr @R, align 4, !tbaa !5
  store i32 0, ptr @L, align 4, !tbaa !5
  %77 = load i32, ptr %9, align 4, !tbaa !5
  %78 = load i32, ptr %8, align 4, !tbaa !5
  %79 = sext i32 %78 to i64
  %80 = getelementptr inbounds [20001 x i32], ptr @pos, i64 0, i64 %79
  store i32 %77, ptr %80, align 4, !tbaa !5
  %81 = load i32, ptr %8, align 4, !tbaa !5
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds [20001 x i32], ptr @a, i64 0, i64 %82
  store i32 1, ptr %83, align 4, !tbaa !5
  %84 = load i32, ptr %8, align 4, !tbaa !5
  %85 = sext i32 %84 to i64
  %86 = getelementptr inbounds [20001 x i32], ptr @b, i64 0, i64 %85
  store i32 0, ptr %86, align 4, !tbaa !5
  %87 = load i32, ptr %8, align 4, !tbaa !5
  %88 = load i32, ptr @R, align 4, !tbaa !5
  %89 = add nsw i32 %88, 1
  store i32 %89, ptr @R, align 4, !tbaa !5
  %90 = sext i32 %88 to i64
  %91 = getelementptr inbounds [20001 x i32], ptr @que, i64 0, i64 %90
  store i32 %87, ptr %91, align 4, !tbaa !5
  br label %92

92:                                               ; preds = %242, %74
  %93 = load i32, ptr @L, align 4, !tbaa !5
  %94 = load i32, ptr @R, align 4, !tbaa !5
  %95 = icmp slt i32 %93, %94
  br i1 %95, label %96, label %243

96:                                               ; preds = %92
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #8
  %97 = load i32, ptr @L, align 4, !tbaa !5
  %98 = add nsw i32 %97, 1
  store i32 %98, ptr @L, align 4, !tbaa !5
  %99 = sext i32 %97 to i64
  %100 = getelementptr inbounds [20001 x i32], ptr @que, i64 0, i64 %99
  %101 = load i32, ptr %100, align 4, !tbaa !5
  store i32 %101, ptr %12, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #8
  %102 = load i32, ptr %12, align 4, !tbaa !5
  %103 = sext i32 %102 to i64
  %104 = getelementptr inbounds [20001 x %"class.std::vector"], ptr @e, i64 0, i64 %103
  %105 = call ptr @_ZNSt6vectorISt4pairIiiESaIS1_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %104) #8
  %106 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %13, i32 0, i32 0
  store ptr %105, ptr %106, align 8
  br label %107

107:                                              ; preds = %240, %96
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #8
  %108 = load i32, ptr %12, align 4, !tbaa !5
  %109 = sext i32 %108 to i64
  %110 = getelementptr inbounds [20001 x %"class.std::vector"], ptr @e, i64 0, i64 %109
  %111 = call ptr @_ZNSt6vectorISt4pairIiiESaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %110) #8
  %112 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %14, i32 0, i32 0
  store ptr %111, ptr %112, align 8
  %113 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPSt4pairIiiESt6vectorIS2_SaIS2_EEEEbRKNS_17__normal_iteratorIT_T0_EESC_(ptr noundef nonnull align 8 dereferenceable(8) %13, ptr noundef nonnull align 8 dereferenceable(8) %14) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #8
  br i1 %113, label %115, label %114

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

115:                                              ; preds = %107
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #8
  %116 = call noundef ptr @_ZNK9__gnu_cxx17__normal_iteratorIPSt4pairIiiESt6vectorIS2_SaIS2_EEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %13) #8
  %117 = getelementptr inbounds %"struct.std::pair", ptr %116, i32 0, i32 0
  %118 = load i32, ptr %117, align 4, !tbaa !11
  store i32 %118, ptr %15, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #8
  %119 = call noundef ptr @_ZNK9__gnu_cxx17__normal_iteratorIPSt4pairIiiESt6vectorIS2_SaIS2_EEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %13) #8
  %120 = getelementptr inbounds %"struct.std::pair", ptr %119, i32 0, i32 1
  %121 = load i32, ptr %120, align 4, !tbaa !13
  store i32 %121, ptr %16, align 4, !tbaa !5
  %122 = load i32, ptr %15, align 4, !tbaa !5
  %123 = sext i32 %122 to i64
  %124 = getelementptr inbounds [20001 x i32], ptr @pos, i64 0, i64 %123
  %125 = load i32, ptr %124, align 4, !tbaa !5
  %126 = icmp ne i32 %125, 0
  br i1 %126, label %154, label %127

127:                                              ; preds = %115
  %128 = load i32, ptr %9, align 4, !tbaa !5
  %129 = load i32, ptr %15, align 4, !tbaa !5
  %130 = sext i32 %129 to i64
  %131 = getelementptr inbounds [20001 x i32], ptr @pos, i64 0, i64 %130
  store i32 %128, ptr %131, align 4, !tbaa !5
  %132 = load i32, ptr %12, align 4, !tbaa !5
  %133 = sext i32 %132 to i64
  %134 = getelementptr inbounds [20001 x i32], ptr @a, i64 0, i64 %133
  %135 = load i32, ptr %134, align 4, !tbaa !5
  %136 = sub nsw i32 0, %135
  %137 = load i32, ptr %15, align 4, !tbaa !5
  %138 = sext i32 %137 to i64
  %139 = getelementptr inbounds [20001 x i32], ptr @a, i64 0, i64 %138
  store i32 %136, ptr %139, align 4, !tbaa !5
  %140 = load i32, ptr %16, align 4, !tbaa !5
  %141 = load i32, ptr %12, align 4, !tbaa !5
  %142 = sext i32 %141 to i64
  %143 = getelementptr inbounds [20001 x i32], ptr @b, i64 0, i64 %142
  %144 = load i32, ptr %143, align 4, !tbaa !5
  %145 = sub nsw i32 %140, %144
  %146 = load i32, ptr %15, align 4, !tbaa !5
  %147 = sext i32 %146 to i64
  %148 = getelementptr inbounds [20001 x i32], ptr @b, i64 0, i64 %147
  store i32 %145, ptr %148, align 4, !tbaa !5
  %149 = load i32, ptr %15, align 4, !tbaa !5
  %150 = load i32, ptr @R, align 4, !tbaa !5
  %151 = add nsw i32 %150, 1
  store i32 %151, ptr @R, align 4, !tbaa !5
  %152 = sext i32 %150 to i64
  %153 = getelementptr inbounds [20001 x i32], ptr @que, i64 0, i64 %152
  store i32 %149, ptr %153, align 4, !tbaa !5
  br label %239

154:                                              ; preds = %115
  %155 = load i32, ptr %12, align 4, !tbaa !5
  %156 = sext i32 %155 to i64
  %157 = getelementptr inbounds [20001 x i32], ptr @a, i64 0, i64 %156
  %158 = load i32, ptr %157, align 4, !tbaa !5
  %159 = load i32, ptr %15, align 4, !tbaa !5
  %160 = sext i32 %159 to i64
  %161 = getelementptr inbounds [20001 x i32], ptr @a, i64 0, i64 %160
  %162 = load i32, ptr %161, align 4, !tbaa !5
  %163 = add nsw i32 %158, %162
  %164 = icmp eq i32 %163, 0
  br i1 %164, label %165, label %177

165:                                              ; preds = %154
  %166 = load i32, ptr %12, align 4, !tbaa !5
  %167 = sext i32 %166 to i64
  %168 = getelementptr inbounds [20001 x i32], ptr @b, i64 0, i64 %167
  %169 = load i32, ptr %168, align 4, !tbaa !5
  %170 = load i32, ptr %15, align 4, !tbaa !5
  %171 = sext i32 %170 to i64
  %172 = getelementptr inbounds [20001 x i32], ptr @b, i64 0, i64 %171
  %173 = load i32, ptr %172, align 4, !tbaa !5
  %174 = add nsw i32 %169, %173
  %175 = load i32, ptr %16, align 4, !tbaa !5
  %176 = icmp eq i32 %174, %175
  br i1 %176, label %238, label %177

177:                                              ; preds = %165, %154
  %178 = load i32, ptr %12, align 4, !tbaa !5
  %179 = sext i32 %178 to i64
  %180 = getelementptr inbounds [20001 x i32], ptr @a, i64 0, i64 %179
  %181 = load i32, ptr %180, align 4, !tbaa !5
  %182 = load i32, ptr %15, align 4, !tbaa !5
  %183 = sext i32 %182 to i64
  %184 = getelementptr inbounds [20001 x i32], ptr @a, i64 0, i64 %183
  %185 = load i32, ptr %184, align 4, !tbaa !5
  %186 = add nsw i32 %181, %185
  %187 = icmp ne i32 %186, 0
  br i1 %187, label %188, label %236

188:                                              ; preds = %177
  %189 = load i32, ptr %16, align 4, !tbaa !5
  %190 = load i32, ptr %12, align 4, !tbaa !5
  %191 = sext i32 %190 to i64
  %192 = getelementptr inbounds [20001 x i32], ptr @b, i64 0, i64 %191
  %193 = load i32, ptr %192, align 4, !tbaa !5
  %194 = sub nsw i32 %189, %193
  %195 = load i32, ptr %15, align 4, !tbaa !5
  %196 = sext i32 %195 to i64
  %197 = getelementptr inbounds [20001 x i32], ptr @b, i64 0, i64 %196
  %198 = load i32, ptr %197, align 4, !tbaa !5
  %199 = sub nsw i32 %194, %198
  %200 = xor i32 %199, -1
  %201 = and i32 %200, 1
  %202 = icmp ne i32 %201, 0
  br i1 %202, label %203, label %236

203:                                              ; preds = %188
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #8
  %204 = load i32, ptr %16, align 4, !tbaa !5
  %205 = load i32, ptr %12, align 4, !tbaa !5
  %206 = sext i32 %205 to i64
  %207 = getelementptr inbounds [20001 x i32], ptr @b, i64 0, i64 %206
  %208 = load i32, ptr %207, align 4, !tbaa !5
  %209 = sub nsw i32 %204, %208
  %210 = load i32, ptr %15, align 4, !tbaa !5
  %211 = sext i32 %210 to i64
  %212 = getelementptr inbounds [20001 x i32], ptr @b, i64 0, i64 %211
  %213 = load i32, ptr %212, align 4, !tbaa !5
  %214 = sub nsw i32 %209, %213
  %215 = load i32, ptr %12, align 4, !tbaa !5
  %216 = sext i32 %215 to i64
  %217 = getelementptr inbounds [20001 x i32], ptr @a, i64 0, i64 %216
  %218 = load i32, ptr %217, align 4, !tbaa !5
  %219 = load i32, ptr %15, align 4, !tbaa !5
  %220 = sext i32 %219 to i64
  %221 = getelementptr inbounds [20001 x i32], ptr @a, i64 0, i64 %220
  %222 = load i32, ptr %221, align 4, !tbaa !5
  %223 = add nsw i32 %218, %222
  %224 = sdiv i32 %214, %223
  store i32 %224, ptr %17, align 4, !tbaa !5
  %225 = load i32, ptr %11, align 4, !tbaa !5
  %226 = icmp eq i32 %225, 1061109567
  br i1 %226, label %227, label %229

227:                                              ; preds = %203
  %228 = load i32, ptr %17, align 4, !tbaa !5
  store i32 %228, ptr %11, align 4, !tbaa !5
  br label %235

229:                                              ; preds = %203
  %230 = load i32, ptr %11, align 4, !tbaa !5
  %231 = load i32, ptr %17, align 4, !tbaa !5
  %232 = icmp ne i32 %230, %231
  br i1 %232, label %233, label %234

233:                                              ; preds = %229
  store i32 -1061109567, ptr %11, align 4, !tbaa !5
  br label %234

234:                                              ; preds = %233, %229
  br label %235

235:                                              ; preds = %234, %227
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #8
  br label %237

236:                                              ; preds = %188, %177
  store i32 -1061109567, ptr %11, align 4, !tbaa !5
  br label %237

237:                                              ; preds = %236, %235
  br label %238

238:                                              ; preds = %237, %165
  br label %239

239:                                              ; preds = %238, %127
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #8
  br label %240

240:                                              ; preds = %239
  %241 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPSt4pairIiiESt6vectorIS2_SaIS2_EEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %13) #8
  br label %107, !llvm.loop !14

242:                                              ; preds = %114
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #8
  br label %92, !llvm.loop !15

243:                                              ; preds = %92
  %244 = load i32, ptr %11, align 4, !tbaa !5
  %245 = icmp eq i32 %244, -1061109567
  br i1 %245, label %246, label %264

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

247:                                              ; preds = %260, %246
  %248 = load i32, ptr %18, align 4, !tbaa !5
  %249 = load i32, ptr @R, align 4, !tbaa !5
  %250 = icmp slt i32 %248, %249
  br i1 %250, label %252, label %251

251:                                              ; preds = %247
  store i32 14, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #8
  br label %263

252:                                              ; preds = %247
  %253 = load i32, ptr %11, align 4, !tbaa !5
  %254 = load i32, ptr %18, align 4, !tbaa !5
  %255 = sext i32 %254 to i64
  %256 = getelementptr inbounds [20001 x i32], ptr @que, i64 0, i64 %255
  %257 = load i32, ptr %256, align 4, !tbaa !5
  %258 = sext i32 %257 to i64
  %259 = getelementptr inbounds [20001 x i32], ptr @a, i64 0, i64 %258
  store i32 %253, ptr %259, align 4, !tbaa !5
  br label %260

260:                                              ; preds = %252
  %261 = load i32, ptr %18, align 4, !tbaa !5
  %262 = add nsw i32 %261, 1
  store i32 %262, ptr %18, align 4, !tbaa !5
  br label %247, !llvm.loop !16

263:                                              ; preds = %251
  br label %302

264:                                              ; preds = %243
  %265 = load i32, ptr %11, align 4, !tbaa !5
  %266 = icmp ne i32 %265, 1061109567
  br i1 %266, label %267, label %301

267:                                              ; preds = %264
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #8
  store i32 0, ptr %19, align 4, !tbaa !5
  br label %268

268:                                              ; preds = %297, %267
  %269 = load i32, ptr %19, align 4, !tbaa !5
  %270 = load i32, ptr @R, align 4, !tbaa !5
  %271 = icmp slt i32 %269, %270
  br i1 %271, label %273, label %272

272:                                              ; preds = %268
  store i32 17, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #8
  br label %300

273:                                              ; preds = %268
  %274 = load i32, ptr %19, align 4, !tbaa !5
  %275 = sext i32 %274 to i64
  %276 = getelementptr inbounds [20001 x i32], ptr @que, i64 0, i64 %275
  %277 = load i32, ptr %276, align 4, !tbaa !5
  %278 = sext i32 %277 to i64
  %279 = getelementptr inbounds [20001 x i32], ptr @a, i64 0, i64 %278
  %280 = load i32, ptr %279, align 4, !tbaa !5
  %281 = load i32, ptr %11, align 4, !tbaa !5
  %282 = mul nsw i32 %280, %281
  %283 = load i32, ptr %19, align 4, !tbaa !5
  %284 = sext i32 %283 to i64
  %285 = getelementptr inbounds [20001 x i32], ptr @que, i64 0, i64 %284
  %286 = load i32, ptr %285, align 4, !tbaa !5
  %287 = sext i32 %286 to i64
  %288 = getelementptr inbounds [20001 x i32], ptr @b, i64 0, i64 %287
  %289 = load i32, ptr %288, align 4, !tbaa !5
  %290 = add nsw i32 %289, %282
  store i32 %290, ptr %288, align 4, !tbaa !5
  %291 = load i32, ptr %19, align 4, !tbaa !5
  %292 = sext i32 %291 to i64
  %293 = getelementptr inbounds [20001 x i32], ptr @que, i64 0, i64 %292
  %294 = load i32, ptr %293, align 4, !tbaa !5
  %295 = sext i32 %294 to i64
  %296 = getelementptr inbounds [20001 x i32], ptr @a, i64 0, i64 %295
  store i32 0, ptr %296, align 4, !tbaa !5
  br label %297

297:                                              ; preds = %273
  %298 = load i32, ptr %19, align 4, !tbaa !5
  %299 = add nsw i32 %298, 1
  store i32 %299, ptr %19, align 4, !tbaa !5
  br label %268, !llvm.loop !17

300:                                              ; preds = %272
  br label %301

301:                                              ; preds = %300, %264
  br label %302

302:                                              ; preds = %301, %263
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #8
  br label %303

303:                                              ; preds = %302, %73
  %304 = load i32, ptr %8, align 4, !tbaa !5
  %305 = add nsw i32 %304, 1
  store i32 %305, ptr %8, align 4, !tbaa !5
  br label %62, !llvm.loop !18

306:                                              ; preds = %66
  br label %307

307:                                              ; preds = %397, %306
  %308 = load i32, ptr @q, align 4, !tbaa !5
  %309 = add nsw i32 %308, -1
  store i32 %309, ptr @q, align 4, !tbaa !5
  %310 = icmp ne i32 %308, 0
  br i1 %310, label %311, label %399

311:                                              ; preds = %307
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #8
  %312 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %20, ptr noundef %21)
  %313 = call noundef i64 @_ZNKSt3mapIiiSt4lessIiESaISt4pairIKiiEEE5countERS3_(ptr noundef nonnull align 8 dereferenceable(48) @Hash, ptr noundef nonnull align 4 dereferenceable(4) %20)
  %314 = icmp ne i64 %313, 0
  br i1 %314, label %315, label %318

315:                                              ; preds = %311
  %316 = call noundef i64 @_ZNKSt3mapIiiSt4lessIiESaISt4pairIKiiEEE5countERS3_(ptr noundef nonnull align 8 dereferenceable(48) @Hash, ptr noundef nonnull align 4 dereferenceable(4) %21)
  %317 = icmp ne i64 %316, 0
  br i1 %317, label %320, label %318

318:                                              ; preds = %315, %311
  %319 = call i32 @putchar(i32 noundef 42)
  br label %397

320:                                              ; preds = %315
  %321 = load i32, ptr %20, align 4, !tbaa !5
  %322 = call noundef i32 @_Z5getIDi(i32 noundef %321)
  store i32 %322, ptr %20, align 4, !tbaa !5
  %323 = load i32, ptr %21, align 4, !tbaa !5
  %324 = call noundef i32 @_Z5getIDi(i32 noundef %323)
  store i32 %324, ptr %21, align 4, !tbaa !5
  %325 = load i32, ptr %20, align 4, !tbaa !5
  %326 = sext i32 %325 to i64
  %327 = getelementptr inbounds [20001 x i32], ptr @pos, i64 0, i64 %326
  %328 = load i32, ptr %327, align 4, !tbaa !5
  %329 = load i32, ptr %21, align 4, !tbaa !5
  %330 = sext i32 %329 to i64
  %331 = getelementptr inbounds [20001 x i32], ptr @pos, i64 0, i64 %330
  %332 = load i32, ptr %331, align 4, !tbaa !5
  %333 = icmp ne i32 %328, %332
  br i1 %333, label %334, label %360

334:                                              ; preds = %320
  %335 = load i32, ptr %20, align 4, !tbaa !5
  %336 = sext i32 %335 to i64
  %337 = getelementptr inbounds [20001 x i32], ptr @a, i64 0, i64 %336
  %338 = load i32, ptr %337, align 4, !tbaa !5
  %339 = icmp ne i32 %338, 0
  br i1 %339, label %346, label %340

340:                                              ; preds = %334
  %341 = load i32, ptr %21, align 4, !tbaa !5
  %342 = sext i32 %341 to i64
  %343 = getelementptr inbounds [20001 x i32], ptr @a, i64 0, i64 %342
  %344 = load i32, ptr %343, align 4, !tbaa !5
  %345 = icmp ne i32 %344, 0
  br i1 %345, label %346, label %348

346:                                              ; preds = %340, %334
  %347 = call i32 @putchar(i32 noundef 42)
  br label %359

348:                                              ; preds = %340
  %349 = load i32, ptr %20, align 4, !tbaa !5
  %350 = sext i32 %349 to i64
  %351 = getelementptr inbounds [20001 x i32], ptr @b, i64 0, i64 %350
  %352 = load i32, ptr %351, align 4, !tbaa !5
  %353 = load i32, ptr %21, align 4, !tbaa !5
  %354 = sext i32 %353 to i64
  %355 = getelementptr inbounds [20001 x i32], ptr @b, i64 0, i64 %354
  %356 = load i32, ptr %355, align 4, !tbaa !5
  %357 = add nsw i32 %352, %356
  %358 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, i32 noundef %357)
  br label %359

359:                                              ; preds = %348, %346
  br label %396

360:                                              ; preds = %320
  %361 = load i32, ptr %20, align 4, !tbaa !5
  %362 = sext i32 %361 to i64
  %363 = getelementptr inbounds [20001 x i32], ptr @a, i64 0, i64 %362
  %364 = load i32, ptr %363, align 4, !tbaa !5
  %365 = load i32, ptr %21, align 4, !tbaa !5
  %366 = sext i32 %365 to i64
  %367 = getelementptr inbounds [20001 x i32], ptr @a, i64 0, i64 %366
  %368 = load i32, ptr %367, align 4, !tbaa !5
  %369 = add nsw i32 %364, %368
  %370 = icmp ne i32 %369, 0
  br i1 %370, label %371, label %373

371:                                              ; preds = %360
  %372 = call i32 @putchar(i32 noundef 42)
  br label %395

373:                                              ; preds = %360
  %374 = load i32, ptr %20, align 4, !tbaa !5
  %375 = load i32, ptr %21, align 4, !tbaa !5
  %376 = icmp ne i32 %374, %375
  br i1 %376, label %377, label %388

377:                                              ; preds = %373
  %378 = load i32, ptr %20, align 4, !tbaa !5
  %379 = sext i32 %378 to i64
  %380 = getelementptr inbounds [20001 x i32], ptr @b, i64 0, i64 %379
  %381 = load i32, ptr %380, align 4, !tbaa !5
  %382 = load i32, ptr %21, align 4, !tbaa !5
  %383 = sext i32 %382 to i64
  %384 = getelementptr inbounds [20001 x i32], ptr @b, i64 0, i64 %383
  %385 = load i32, ptr %384, align 4, !tbaa !5
  %386 = add nsw i32 %381, %385
  %387 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, i32 noundef %386)
  br label %394

388:                                              ; preds = %373
  %389 = load i32, ptr %20, align 4, !tbaa !5
  %390 = sext i32 %389 to i64
  %391 = getelementptr inbounds [20001 x i32], ptr @b, i64 0, i64 %390
  %392 = load i32, ptr %391, align 4, !tbaa !5
  %393 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, i32 noundef %392)
  br label %394

394:                                              ; preds = %388, %377
  br label %395

395:                                              ; preds = %394, %371
  br label %396

396:                                              ; preds = %395, %359
  br label %397

397:                                              ; preds = %396, %318
  %398 = call i32 @putchar(i32 noundef 10)
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #8
  br label %307, !llvm.loop !19

399:                                              ; preds = %307
  %400 = call i32 @putchar(i32 noundef 45)
  %401 = call i32 @putchar(i32 noundef 10)
  br label %22, !llvm.loop !20

402:                                              ; preds = %30
  ret i32 0
}

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEE4swapERS6_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(48)) #0 align 2

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_Z5getIDi(i32 noundef) #5

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

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

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

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_ZNKSt3mapIiiSt4lessIiESaISt4pairIKiiEEE5countERS3_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 4 dereferenceable(4)) #6 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare i32 @putchar(i32 noundef) #5

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

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

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

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


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

%"class.std::map" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<int, std::pair<const int, int>, std::_Select1st<std::pair<const int, int>>, std::less<int>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<int, std::pair<const int, int>, std::_Select1st<std::pair<const int, int>>, std::less<int>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"struct.std::pair" = type { i32, i32 }
%"class.__gnu_cxx::__normal_iterator" = type { ptr }

@Hash = external dso_local global %"class.std::map", align 8
@n = external dso_local local_unnamed_addr global i32, align 4
@m = external dso_local global i32, align 4
@q = external dso_local global i32, align 4
@pos = external dso_local local_unnamed_addr global [20001 x i32], align 16
@a = external dso_local local_unnamed_addr global [20001 x i32], align 16
@b = external dso_local local_unnamed_addr global [20001 x i32], align 16
@que = external dso_local local_unnamed_addr global [20001 x i32], align 16
@L = external dso_local local_unnamed_addr global i32, align 4
@R = external dso_local local_unnamed_addr global i32, align 4
@e = external dso_local global [20001 x %"class.std::vector"], align 16
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [3 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEEC2Ev(ptr noundef nonnull align 8 dereferenceable(48)) unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEED2Ev(ptr noundef nonnull align 8 dereferenceable(48)) unnamed_addr #0 align 2

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #1 {
  %1 = alloca %"class.std::map", align 8
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca %"struct.std::pair", align 8
  %6 = alloca %"struct.std::pair", align 8
  %7 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %8 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @m, ptr noundef nonnull @q)
  %12 = icmp eq i32 %11, 2
  %13 = load i32, ptr @m, align 4
  %14 = load i32, ptr @q, align 4
  %15 = sub i32 0, %14
  %16 = icmp ne i32 %13, %15
  %17 = select i1 %12, i1 %16, i1 false
  br i1 %17, label %.lr.ph100, label %._crit_edge101

.lr.ph100:                                        ; preds = %0, %._crit_edge98
  store i32 0, ptr @n, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %1) #9
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(48) %1, i8 0, i64 48, i1 false)
  call void @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEEC2Ev(ptr noundef nonnull align 8 dereferenceable(48) %1) #9
  call void @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEE4swapERS6_(ptr noundef nonnull align 8 dereferenceable(48) %1, ptr noundef nonnull align 8 dereferenceable(48) @Hash) #9
  call void @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %1) #9
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %1) #9
  %18 = load i32, ptr @m, align 4, !tbaa !5
  %19 = add nsw i32 %18, -1
  store i32 %19, ptr @m, align 4, !tbaa !5
  %.not77 = icmp eq i32 %18, 0
  br i1 %.not77, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph100, %30
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #9
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #9
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #9
  %20 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %2, ptr noundef nonnull %3, ptr noundef nonnull %4)
  %21 = load i32, ptr %2, align 4, !tbaa !5
  %22 = call noundef i32 @_Z5getIDi(i32 noundef %21)
  store i32 %22, ptr %2, align 4, !tbaa !5
  %23 = load i32, ptr %3, align 4, !tbaa !5
  %24 = call noundef i32 @_Z5getIDi(i32 noundef %23)
  store i32 %24, ptr %3, align 4, !tbaa !5
  %25 = load i32, ptr %2, align 4, !tbaa !5
  %26 = icmp eq i32 %25, %24
  br i1 %26, label %27, label %30

27:                                               ; preds = %.lr.ph
  %28 = load i32, ptr %4, align 4, !tbaa !5
  %29 = shl i32 %28, 1
  store i32 %29, ptr %4, align 4, !tbaa !5
  br label %30

30:                                               ; preds = %27, %.lr.ph
  %31 = sext i32 %25 to i64
  %32 = getelementptr inbounds [20001 x %"class.std::vector"], ptr @e, i64 0, i64 %31
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #9
  %33 = call i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %3, ptr noundef nonnull align 4 dereferenceable(4) %4)
  store i64 %33, ptr %5, align 8
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24) %32, ptr noundef nonnull align 4 dereferenceable(8) %5)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #9
  %34 = load i32, ptr %3, align 4, !tbaa !5
  %35 = sext i32 %34 to i64
  %36 = getelementptr inbounds [20001 x %"class.std::vector"], ptr @e, i64 0, i64 %35
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #9
  %37 = call i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %2, ptr noundef nonnull align 4 dereferenceable(4) %4)
  store i64 %37, ptr %6, align 8
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24) %36, ptr noundef nonnull align 4 dereferenceable(8) %6)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #9
  %38 = load i32, ptr @m, align 4, !tbaa !5
  %39 = add nsw i32 %38, -1
  store i32 %39, ptr @m, align 4, !tbaa !5
  %.not = icmp eq i32 %38, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph, !llvm.loop !9

._crit_edge:                                      ; preds = %30, %.lr.ph100
  %40 = load i32, ptr @n, align 4, !tbaa !5
  %41 = sext i32 %40 to i64
  %42 = shl nsw i64 %41, 2
  call void @llvm.memset.p0.i64(ptr nonnull align 16 @pos, i8 0, i64 %42, i1 false)
  %43 = icmp sgt i32 %40, 0
  br i1 %43, label %.lr.ph95, label %.preheader76

.preheader76:                                     ; preds = %.loopexit, %._crit_edge
  %44 = load i32, ptr @q, align 4, !tbaa !5
  %45 = add nsw i32 %44, -1
  store i32 %45, ptr @q, align 4, !tbaa !5
  %.not5896 = icmp eq i32 %44, 0
  br i1 %.not5896, label %._crit_edge98, label %.lr.ph97

.lr.ph95:                                         ; preds = %._crit_edge, %.loopexit
  %indvars.iv110 = phi i64 [ %indvars.iv.next111, %.loopexit ], [ 0, %._crit_edge ]
  %.05392 = phi i32 [ %.1, %.loopexit ], [ 0, %._crit_edge ]
  %46 = getelementptr inbounds [20001 x i32], ptr @pos, i64 0, i64 %indvars.iv110
  %47 = load i32, ptr %46, align 4, !tbaa !5
  %.not66 = icmp eq i32 %47, 0
  br i1 %.not66, label %.lr.ph84.preheader, label %.loopexit

.lr.ph84.preheader:                               ; preds = %.lr.ph95
  %48 = add nsw i32 %.05392, 1
  store i32 %48, ptr %46, align 4, !tbaa !5
  %49 = getelementptr inbounds [20001 x i32], ptr @a, i64 0, i64 %indvars.iv110
  store i32 1, ptr %49, align 4, !tbaa !5
  %50 = getelementptr inbounds [20001 x i32], ptr @b, i64 0, i64 %indvars.iv110
  store i32 0, ptr %50, align 4, !tbaa !5
  store i32 1, ptr @R, align 4, !tbaa !5
  %51 = trunc nuw nsw i64 %indvars.iv110 to i32
  store i32 %51, ptr @que, align 16, !tbaa !5
  br label %.lr.ph84

.lr.ph84:                                         ; preds = %.lr.ph84.preheader, %._crit_edge81
  %52 = phi i32 [ %64, %._crit_edge81 ], [ 0, %.lr.ph84.preheader ]
  %.05482 = phi i32 [ %.155.lcssa, %._crit_edge81 ], [ 1061109567, %.lr.ph84.preheader ]
  %53 = add nsw i32 %52, 1
  store i32 %53, ptr @L, align 4, !tbaa !5
  %54 = sext i32 %52 to i64
  %55 = getelementptr inbounds [20001 x i32], ptr @que, i64 0, i64 %54
  %56 = load i32, ptr %55, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #9
  %57 = sext i32 %56 to i64
  %58 = getelementptr inbounds [20001 x %"class.std::vector"], ptr @e, i64 0, i64 %57
  %59 = call ptr @_ZNSt6vectorISt4pairIiiESaIS1_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %58) #9
  store ptr %59, ptr %7, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #9
  %60 = call ptr @_ZNSt6vectorISt4pairIiiESaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %58) #9
  store ptr %60, ptr %8, align 8
  %61 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPSt4pairIiiESt6vectorIS2_SaIS2_EEEEbRKNS_17__normal_iteratorIT_T0_EESC_(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 %61, label %.lr.ph80, label %._crit_edge81

.lr.ph80:                                         ; preds = %.lr.ph84
  %62 = getelementptr inbounds [20001 x i32], ptr @a, i64 0, i64 %57
  %63 = getelementptr inbounds [20001 x i32], ptr @b, i64 0, i64 %57
  br label %67

._crit_edge81:                                    ; preds = %111, %.lr.ph84
  %.155.lcssa = phi i32 [ %.05482, %.lr.ph84 ], [ %.3, %111 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #9
  %64 = load i32, ptr @L, align 4, !tbaa !5
  %65 = load i32, ptr @R, align 4, !tbaa !5
  %66 = icmp slt i32 %64, %65
  br i1 %66, label %.lr.ph84, label %._crit_edge85, !llvm.loop !11

67:                                               ; preds = %.lr.ph80, %111
  %.15578 = phi i32 [ %.05482, %.lr.ph80 ], [ %.3, %111 ]
  %68 = call noundef ptr @_ZNK9__gnu_cxx17__normal_iteratorIPSt4pairIiiESt6vectorIS2_SaIS2_EEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %7) #9
  %69 = load i32, ptr %68, align 4, !tbaa !12
  %70 = call noundef ptr @_ZNK9__gnu_cxx17__normal_iteratorIPSt4pairIiiESt6vectorIS2_SaIS2_EEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %7) #9
  %71 = getelementptr inbounds i8, ptr %70, i64 4
  %72 = load i32, ptr %71, align 4, !tbaa !14
  %73 = sext i32 %69 to i64
  %74 = getelementptr inbounds [20001 x i32], ptr @pos, i64 0, i64 %73
  %75 = load i32, ptr %74, align 4, !tbaa !5
  %.not68 = icmp eq i32 %75, 0
  br i1 %.not68, label %76, label %87

76:                                               ; preds = %67
  store i32 %48, ptr %74, align 4, !tbaa !5
  %77 = load i32, ptr %62, align 4, !tbaa !5
  %78 = sub nsw i32 0, %77
  %79 = getelementptr inbounds [20001 x i32], ptr @a, i64 0, i64 %73
  store i32 %78, ptr %79, align 4, !tbaa !5
  %80 = load i32, ptr %63, align 4, !tbaa !5
  %81 = sub nsw i32 %72, %80
  %82 = getelementptr inbounds [20001 x i32], ptr @b, i64 0, i64 %73
  store i32 %81, ptr %82, align 4, !tbaa !5
  %83 = load i32, ptr @R, align 4, !tbaa !5
  %84 = add nsw i32 %83, 1
  store i32 %84, ptr @R, align 4, !tbaa !5
  %85 = sext i32 %83 to i64
  %86 = getelementptr inbounds [20001 x i32], ptr @que, i64 0, i64 %85
  store i32 %69, ptr %86, align 4, !tbaa !5
  br label %111

87:                                               ; preds = %67
  %88 = load i32, ptr %62, align 4, !tbaa !5
  %89 = getelementptr inbounds [20001 x i32], ptr @a, i64 0, i64 %73
  %90 = load i32, ptr %89, align 4, !tbaa !5
  %91 = sub i32 0, %90
  %92 = icmp eq i32 %88, %91
  br i1 %92, label %93, label %99

93:                                               ; preds = %87
  %94 = load i32, ptr %63, align 4, !tbaa !5
  %95 = getelementptr inbounds [20001 x i32], ptr @b, i64 0, i64 %73
  %96 = load i32, ptr %95, align 4, !tbaa !5
  %97 = add nsw i32 %96, %94
  %98 = icmp eq i32 %97, %72
  br i1 %98, label %111, label %99

99:                                               ; preds = %93, %87
  %100 = add nsw i32 %90, %88
  %.not69 = icmp eq i32 %100, 0
  br i1 %.not69, label %111, label %101

101:                                              ; preds = %99
  %102 = load i32, ptr %63, align 4, !tbaa !5
  %103 = getelementptr inbounds [20001 x i32], ptr @b, i64 0, i64 %73
  %104 = load i32, ptr %103, align 4, !tbaa !5
  %105 = add i32 %102, %104
  %106 = sub i32 %72, %105
  %107 = and i32 %106, 1
  %.not70.not = icmp eq i32 %107, 0
  br i1 %.not70.not, label %108, label %111

108:                                              ; preds = %101
  %109 = sdiv i32 %106, %100
  %110 = icmp eq i32 %.15578, 1061109567
  %.not71 = icmp eq i32 %.15578, %109
  %spec.store.select = select i1 %.not71, i32 %.15578, i32 -1061109567
  %.2 = select i1 %110, i32 %109, i32 %spec.store.select
  br label %111

111:                                              ; preds = %99, %101, %93, %108, %76
  %.3 = phi i32 [ %.15578, %93 ], [ %.2, %108 ], [ %.15578, %76 ], [ -1061109567, %101 ], [ -1061109567, %99 ]
  %112 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPSt4pairIiiESt6vectorIS2_SaIS2_EEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %7) #9
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #9
  %113 = call ptr @_ZNSt6vectorISt4pairIiiESaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %58) #9
  store ptr %113, ptr %8, align 8
  %114 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPSt4pairIiiESt6vectorIS2_SaIS2_EEEEbRKNS_17__normal_iteratorIT_T0_EESC_(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 %114, label %67, label %._crit_edge81, !llvm.loop !15

._crit_edge85:                                    ; preds = %._crit_edge81
  switch i32 %.155.lcssa, label %.preheader [
    i32 -1061109567, label %.preheader74
    i32 1061109567, label %.loopexit
  ]

.preheader74:                                     ; preds = %._crit_edge85
  %115 = icmp sgt i32 %65, 0
  br i1 %115, label %.lr.ph89.preheader, label %.loopexit

.lr.ph89.preheader:                               ; preds = %.preheader74
  %wide.trip.count = zext nneg i32 %65 to i64
  %xtraiter = and i64 %wide.trip.count, 3
  %116 = icmp ult i32 %65, 4
  br i1 %116, label %.loopexit.loopexit115.unr-lcssa, label %.lr.ph89.preheader.new

.lr.ph89.preheader.new:                           ; preds = %.lr.ph89.preheader
  %unroll_iter = and i64 %wide.trip.count, 2147483644
  br label %.lr.ph89

.preheader:                                       ; preds = %._crit_edge85
  %117 = icmp sgt i32 %65, 0
  br i1 %117, label %.lr.ph91.preheader, label %.loopexit

.lr.ph91.preheader:                               ; preds = %.preheader
  %wide.trip.count108 = zext nneg i32 %65 to i64
  %xtraiter116 = and i64 %wide.trip.count108, 1
  %118 = icmp eq i32 %65, 1
  br i1 %118, label %.loopexit.loopexit.unr-lcssa, label %.lr.ph91.preheader.new

.lr.ph91.preheader.new:                           ; preds = %.lr.ph91.preheader
  %unroll_iter119 = and i64 %wide.trip.count108, 2147483646
  br label %.lr.ph91

.lr.ph89:                                         ; preds = %.lr.ph89, %.lr.ph89.preheader.new
  %indvars.iv = phi i64 [ 0, %.lr.ph89.preheader.new ], [ %indvars.iv.next.3, %.lr.ph89 ]
  %niter = phi i64 [ 0, %.lr.ph89.preheader.new ], [ %niter.next.3, %.lr.ph89 ]
  %119 = getelementptr inbounds [20001 x i32], ptr @que, i64 0, i64 %indvars.iv
  %120 = load i32, ptr %119, align 16, !tbaa !5
  %121 = sext i32 %120 to i64
  %122 = getelementptr inbounds [20001 x i32], ptr @a, i64 0, i64 %121
  store i32 -1061109567, ptr %122, align 4, !tbaa !5
  %indvars.iv.next = or disjoint i64 %indvars.iv, 1
  %123 = getelementptr inbounds [20001 x i32], ptr @que, i64 0, i64 %indvars.iv.next
  %124 = load i32, ptr %123, align 4, !tbaa !5
  %125 = sext i32 %124 to i64
  %126 = getelementptr inbounds [20001 x i32], ptr @a, i64 0, i64 %125
  store i32 -1061109567, ptr %126, align 4, !tbaa !5
  %indvars.iv.next.1 = or disjoint i64 %indvars.iv, 2
  %127 = getelementptr inbounds [20001 x i32], ptr @que, i64 0, i64 %indvars.iv.next.1
  %128 = load i32, ptr %127, align 8, !tbaa !5
  %129 = sext i32 %128 to i64
  %130 = getelementptr inbounds [20001 x i32], ptr @a, i64 0, i64 %129
  store i32 -1061109567, ptr %130, align 4, !tbaa !5
  %indvars.iv.next.2 = or disjoint i64 %indvars.iv, 3
  %131 = getelementptr inbounds [20001 x i32], ptr @que, i64 0, i64 %indvars.iv.next.2
  %132 = load i32, ptr %131, align 4, !tbaa !5
  %133 = sext i32 %132 to i64
  %134 = getelementptr inbounds [20001 x i32], ptr @a, i64 0, i64 %133
  store i32 -1061109567, ptr %134, align 4, !tbaa !5
  %indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
  %niter.next.3 = add i64 %niter, 4
  %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
  br i1 %niter.ncmp.3, label %.loopexit.loopexit115.unr-lcssa, label %.lr.ph89, !llvm.loop !16

.lr.ph91:                                         ; preds = %.lr.ph91, %.lr.ph91.preheader.new
  %indvars.iv105 = phi i64 [ 0, %.lr.ph91.preheader.new ], [ %indvars.iv.next106.1, %.lr.ph91 ]
  %niter120 = phi i64 [ 0, %.lr.ph91.preheader.new ], [ %niter120.next.1, %.lr.ph91 ]
  %135 = getelementptr inbounds [20001 x i32], ptr @que, i64 0, i64 %indvars.iv105
  %136 = load i32, ptr %135, align 8, !tbaa !5
  %137 = sext i32 %136 to i64
  %138 = getelementptr inbounds [20001 x i32], ptr @a, i64 0, i64 %137
  %139 = load i32, ptr %138, align 4, !tbaa !5
  %140 = mul nsw i32 %139, %.155.lcssa
  %141 = getelementptr inbounds [20001 x i32], ptr @b, i64 0, i64 %137
  %142 = load i32, ptr %141, align 4, !tbaa !5
  %143 = add nsw i32 %142, %140
  store i32 %143, ptr %141, align 4, !tbaa !5
  store i32 0, ptr %138, align 4, !tbaa !5
  %indvars.iv.next106 = or disjoint i64 %indvars.iv105, 1
  %144 = getelementptr inbounds [20001 x i32], ptr @que, i64 0, i64 %indvars.iv.next106
  %145 = load i32, ptr %144, align 4, !tbaa !5
  %146 = sext i32 %145 to i64
  %147 = getelementptr inbounds [20001 x i32], ptr @a, i64 0, i64 %146
  %148 = load i32, ptr %147, align 4, !tbaa !5
  %149 = mul nsw i32 %148, %.155.lcssa
  %150 = getelementptr inbounds [20001 x i32], ptr @b, i64 0, i64 %146
  %151 = load i32, ptr %150, align 4, !tbaa !5
  %152 = add nsw i32 %151, %149
  store i32 %152, ptr %150, align 4, !tbaa !5
  store i32 0, ptr %147, align 4, !tbaa !5
  %indvars.iv.next106.1 = add nuw nsw i64 %indvars.iv105, 2
  %niter120.next.1 = add i64 %niter120, 2
  %niter120.ncmp.1 = icmp eq i64 %niter120.next.1, %unroll_iter119
  br i1 %niter120.ncmp.1, label %.loopexit.loopexit.unr-lcssa, label %.lr.ph91, !llvm.loop !17

.loopexit.loopexit.unr-lcssa:                     ; preds = %.lr.ph91, %.lr.ph91.preheader
  %indvars.iv105.unr = phi i64 [ 0, %.lr.ph91.preheader ], [ %indvars.iv.next106.1, %.lr.ph91 ]
  %lcmp.mod118.not = icmp eq i64 %xtraiter116, 0
  br i1 %lcmp.mod118.not, label %.loopexit, label %.lr.ph91.epil

.lr.ph91.epil:                                    ; preds = %.loopexit.loopexit.unr-lcssa
  %153 = getelementptr inbounds [20001 x i32], ptr @que, i64 0, i64 %indvars.iv105.unr
  %154 = load i32, ptr %153, align 4, !tbaa !5
  %155 = sext i32 %154 to i64
  %156 = getelementptr inbounds [20001 x i32], ptr @a, i64 0, i64 %155
  %157 = load i32, ptr %156, align 4, !tbaa !5
  %158 = mul nsw i32 %157, %.155.lcssa
  %159 = getelementptr inbounds [20001 x i32], ptr @b, i64 0, i64 %155
  %160 = load i32, ptr %159, align 4, !tbaa !5
  %161 = add nsw i32 %160, %158
  store i32 %161, ptr %159, align 4, !tbaa !5
  store i32 0, ptr %156, align 4, !tbaa !5
  br label %.loopexit

.loopexit.loopexit115.unr-lcssa:                  ; preds = %.lr.ph89, %.lr.ph89.preheader
  %indvars.iv.unr = phi i64 [ 0, %.lr.ph89.preheader ], [ %indvars.iv.next.3, %.lr.ph89 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.loopexit, label %.lr.ph89.epil

.lr.ph89.epil:                                    ; preds = %.loopexit.loopexit115.unr-lcssa, %.lr.ph89.epil
  %indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %.lr.ph89.epil ], [ %indvars.iv.unr, %.loopexit.loopexit115.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.lr.ph89.epil ], [ 0, %.loopexit.loopexit115.unr-lcssa ]
  %162 = getelementptr inbounds [20001 x i32], ptr @que, i64 0, i64 %indvars.iv.epil
  %163 = load i32, ptr %162, align 4, !tbaa !5
  %164 = sext i32 %163 to i64
  %165 = getelementptr inbounds [20001 x i32], ptr @a, i64 0, i64 %164
  store i32 -1061109567, ptr %165, align 4, !tbaa !5
  %indvars.iv.next.epil = add nuw nsw i64 %indvars.iv.epil, 1
  %epil.iter.next = add i64 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
  br i1 %epil.iter.cmp.not, label %.loopexit, label %.lr.ph89.epil, !llvm.loop !18

.loopexit:                                        ; preds = %.loopexit.loopexit115.unr-lcssa, %.lr.ph89.epil, %.lr.ph91.epil, %.loopexit.loopexit.unr-lcssa, %.preheader74, %.preheader, %._crit_edge85, %.lr.ph95
  %.1 = phi i32 [ %.05392, %.lr.ph95 ], [ %48, %._crit_edge85 ], [ %48, %.preheader ], [ %48, %.preheader74 ], [ %48, %.loopexit.loopexit.unr-lcssa ], [ %48, %.lr.ph91.epil ], [ %48, %.lr.ph89.epil ], [ %48, %.loopexit.loopexit115.unr-lcssa ]
  %indvars.iv.next111 = add nuw nsw i64 %indvars.iv110, 1
  %166 = load i32, ptr @n, align 4, !tbaa !5
  %167 = sext i32 %166 to i64
  %168 = icmp slt i64 %indvars.iv.next111, %167
  br i1 %168, label %.lr.ph95, label %.preheader76, !llvm.loop !20

.lr.ph97:                                         ; preds = %.preheader76, %218
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %9) #9
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %10) #9
  %169 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %9, ptr noundef nonnull %10)
  %170 = call noundef i64 @_ZNKSt3mapIiiSt4lessIiESaISt4pairIKiiEEE5countERS3_(ptr noundef nonnull align 8 dereferenceable(48) @Hash, ptr noundef nonnull align 4 dereferenceable(4) %9)
  %.not59 = icmp eq i64 %170, 0
  br i1 %.not59, label %173, label %171

171:                                              ; preds = %.lr.ph97
  %172 = call noundef i64 @_ZNKSt3mapIiiSt4lessIiESaISt4pairIKiiEEE5countERS3_(ptr noundef nonnull align 8 dereferenceable(48) @Hash, ptr noundef nonnull align 4 dereferenceable(4) %10)
  %.not60 = icmp eq i64 %172, 0
  br i1 %.not60, label %173, label %175

173:                                              ; preds = %171, %.lr.ph97
  %174 = call i32 @putchar(i32 noundef 42)
  br label %218

175:                                              ; preds = %171
  %176 = load i32, ptr %9, align 4, !tbaa !5
  %177 = call noundef i32 @_Z5getIDi(i32 noundef %176)
  store i32 %177, ptr %9, align 4, !tbaa !5
  %178 = load i32, ptr %10, align 4, !tbaa !5
  %179 = call noundef i32 @_Z5getIDi(i32 noundef %178)
  store i32 %179, ptr %10, align 4, !tbaa !5
  %180 = load i32, ptr %9, align 4, !tbaa !5
  %181 = sext i32 %180 to i64
  %182 = getelementptr inbounds [20001 x i32], ptr @pos, i64 0, i64 %181
  %183 = load i32, ptr %182, align 4, !tbaa !5
  %184 = sext i32 %179 to i64
  %185 = getelementptr inbounds [20001 x i32], ptr @pos, i64 0, i64 %184
  %186 = load i32, ptr %185, align 4, !tbaa !5
  %.not61 = icmp eq i32 %183, %186
  %187 = getelementptr inbounds [20001 x i32], ptr @a, i64 0, i64 %181
  %188 = load i32, ptr %187, align 4, !tbaa !5
  br i1 %.not61, label %202, label %189

189:                                              ; preds = %175
  %.not64 = icmp eq i32 %188, 0
  br i1 %.not64, label %190, label %193

190:                                              ; preds = %189
  %191 = getelementptr inbounds [20001 x i32], ptr @a, i64 0, i64 %184
  %192 = load i32, ptr %191, align 4, !tbaa !5
  %.not65 = icmp eq i32 %192, 0
  br i1 %.not65, label %195, label %193

193:                                              ; preds = %190, %189
  %194 = call i32 @putchar(i32 noundef 42)
  br label %218

195:                                              ; preds = %190
  %196 = getelementptr inbounds [20001 x i32], ptr @b, i64 0, i64 %181
  %197 = load i32, ptr %196, align 4, !tbaa !5
  %198 = getelementptr inbounds [20001 x i32], ptr @b, i64 0, i64 %184
  %199 = load i32, ptr %198, align 4, !tbaa !5
  %200 = add nsw i32 %199, %197
  %201 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %200)
  br label %218

202:                                              ; preds = %175
  %203 = getelementptr inbounds [20001 x i32], ptr @a, i64 0, i64 %184
  %204 = load i32, ptr %203, align 4, !tbaa !5
  %205 = sub i32 0, %204
  %.not62 = icmp eq i32 %188, %205
  br i1 %.not62, label %208, label %206

206:                                              ; preds = %202
  %207 = call i32 @putchar(i32 noundef 42)
  br label %218

208:                                              ; preds = %202
  %.not63 = icmp eq i32 %180, %179
  %209 = getelementptr inbounds [20001 x i32], ptr @b, i64 0, i64 %181
  %210 = load i32, ptr %209, align 4, !tbaa !5
  br i1 %.not63, label %216, label %211

211:                                              ; preds = %208
  %212 = getelementptr inbounds [20001 x i32], ptr @b, i64 0, i64 %184
  %213 = load i32, ptr %212, align 4, !tbaa !5
  %214 = add nsw i32 %213, %210
  %215 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %214)
  br label %218

216:                                              ; preds = %208
  %217 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %210)
  br label %218

218:                                              ; preds = %195, %193, %211, %216, %206, %173
  %219 = call i32 @putchar(i32 noundef 10)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %10) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %9) #9
  %220 = load i32, ptr @q, align 4, !tbaa !5
  %221 = add nsw i32 %220, -1
  store i32 %221, ptr @q, align 4, !tbaa !5
  %.not58 = icmp eq i32 %220, 0
  br i1 %.not58, label %._crit_edge98, label %.lr.ph97, !llvm.loop !21

._crit_edge98:                                    ; preds = %218, %.preheader76
  %222 = call i32 @putchar(i32 noundef 45)
  %223 = call i32 @putchar(i32 noundef 10)
  %224 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @m, ptr noundef nonnull @q)
  %225 = icmp eq i32 %224, 2
  %226 = load i32, ptr @m, align 4
  %227 = load i32, ptr @q, align 4
  %228 = sub i32 0, %227
  %229 = icmp ne i32 %226, %228
  %230 = select i1 %225, i1 %229, i1 false
  br i1 %230, label %.lr.ph100, label %._crit_edge101, !llvm.loop !22

._crit_edge101:                                   ; preds = %._crit_edge98, %0
  ret i32 0
}

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEE4swapERS6_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(48)) local_unnamed_addr #0 align 2

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_Z5getIDi(i32 noundef) local_unnamed_addr #5

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

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

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

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_ZNKSt3mapIiiSt4lessIiESaISt4pairIKiiEEE5countERS3_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #6 align 2

; Function Attrs: inlinehint mustprogress nofree nounwind uwtable
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #8

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

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

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

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


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