; LLVM IR from tangjz/acm-icpc :: hdu (5336)

; 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<std::pair<int, int>, std::pair<const std::pair<int, int>, int>, std::_Select1st<std::pair<const std::pair<int, int>, int>>, std::less<std::pair<int, int>>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<std::pair<int, int>, std::pair<const std::pair<int, int>, int>, std::_Select1st<std::pair<const std::pair<int, int>, int>>, std::less<std::pair<int, 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 }
%struct.Point = type { i32, i32, i32 }
%"struct.std::pair" = type { i32, i32 }

@Hash = external dso_local global %"class.std::map", align 8
@r = external dso_local global i32, align 4
@c = external dso_local global i32, align 4
@n = external dso_local global i32, align 4
@t = external dso_local global i32, align 4
@val = external dso_local global [10000 x i32], align 16
@L = external dso_local global i32, align 4
@R = external dso_local global i32, align 4
@ans = external dso_local global [10000 x i32], align 16
@a = external dso_local global [10000 x %struct.Point], align 16
@que = external dso_local global [10000 x %struct.Point], align 16
@.str = external hidden unnamed_addr constant [9 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [5 x i8], align 1
@_ZL1d = external hidden constant [4 x [2 x i32]], align 16
@.str.3 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [6 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z5validii(i32 noundef, i32 noundef) #0

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #1 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca %"struct.std::pair", 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 %struct.Point, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca %struct.Point, align 4
  %14 = alloca %"struct.std::pair", align 4
  %15 = alloca i32, align 4
  %16 = alloca %"struct.std::pair", align 4
  %17 = alloca i32, align 4
  %18 = alloca %"struct.std::pair", align 4
  %19 = alloca i32, align 4
  %20 = alloca %struct.Point, align 4
  %21 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  br label %22

22:                                               ; preds = %284, %0
  %23 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @r, ptr noundef @c, ptr noundef @n, ptr noundef @t)
  %24 = icmp eq i32 %23, 4
  br i1 %24, label %25, label %285

25:                                               ; preds = %22
  store i32 0, ptr @R, align 4, !tbaa !5
  store i32 0, ptr @L, align 4, !tbaa !5
  call void @_ZNSt3mapISt4pairIiiEiSt4lessIS1_ESaIS0_IKS1_iEEE5clearEv(ptr noundef nonnull align 8 dereferenceable(48) @Hash) #7
  call void @llvm.memset.p0.i64(ptr align 16 @ans, i8 0, i64 40000, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #7
  store i32 1, ptr %2, align 4, !tbaa !5
  br label %26

26:                                               ; preds = %55, %25
  %27 = load i32, ptr %2, align 4, !tbaa !5
  %28 = load i32, ptr @n, align 4, !tbaa !5
  %29 = icmp sle i32 %27, %28
  br i1 %29, label %31, label %30

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

31:                                               ; preds = %26
  %32 = load i32, ptr %2, align 4, !tbaa !5
  %33 = sext i32 %32 to i64
  %34 = getelementptr inbounds [10000 x %struct.Point], ptr @a, i64 0, i64 %33
  %35 = getelementptr inbounds %struct.Point, ptr %34, i32 0, i32 1
  %36 = load i32, ptr %2, align 4, !tbaa !5
  %37 = sext i32 %36 to i64
  %38 = getelementptr inbounds [10000 x %struct.Point], ptr @a, i64 0, i64 %37
  %39 = getelementptr inbounds %struct.Point, ptr %38, i32 0, i32 2
  %40 = load i32, ptr %2, align 4, !tbaa !5
  %41 = sext i32 %40 to i64
  %42 = getelementptr inbounds [10000 x i32], ptr @val, i64 0, i64 %41
  %43 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %35, ptr noundef %39, ptr noundef %42)
  %44 = load i32, ptr %2, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #7
  %45 = load i32, ptr %2, align 4, !tbaa !5
  %46 = sext i32 %45 to i64
  %47 = getelementptr inbounds [10000 x %struct.Point], ptr @a, i64 0, i64 %46
  %48 = getelementptr inbounds %struct.Point, ptr %47, i32 0, i32 1
  %49 = load i32, ptr %2, align 4, !tbaa !5
  %50 = sext i32 %49 to i64
  %51 = getelementptr inbounds [10000 x %struct.Point], ptr @a, i64 0, i64 %50
  %52 = getelementptr inbounds %struct.Point, ptr %51, i32 0, i32 2
  %53 = call i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %48, ptr noundef nonnull align 4 dereferenceable(4) %52)
  store i64 %53, ptr %3, align 4
  %54 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapISt4pairIiiEiSt4lessIS1_ESaIS0_IKS1_iEEEixEOS1_(ptr noundef nonnull align 8 dereferenceable(48) @Hash, ptr noundef nonnull align 4 dereferenceable(8) %3)
  store i32 %44, ptr %54, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #7
  br label %55

55:                                               ; preds = %31
  %56 = load i32, ptr %2, align 4, !tbaa !5
  %57 = add nsw i32 %56, 1
  store i32 %57, ptr %2, align 4, !tbaa !5
  br label %26, !llvm.loop !9

58:                                               ; preds = %30
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #7
  %59 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.2, ptr noundef %4, ptr noundef %5)
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #7
  store i32 0, ptr %6, align 4, !tbaa !5
  br label %60

60:                                               ; preds = %94, %58
  %61 = load i32, ptr %6, align 4, !tbaa !5
  %62 = icmp slt i32 %61, 4
  br i1 %62, label %64, label %63

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

64:                                               ; preds = %60
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #7
  %65 = load i32, ptr %4, align 4, !tbaa !5
  %66 = load i32, ptr %6, align 4, !tbaa !5
  %67 = sext i32 %66 to i64
  %68 = getelementptr inbounds [4 x [2 x i32]], ptr @_ZL1d, i64 0, i64 %67
  %69 = getelementptr inbounds [2 x i32], ptr %68, i64 0, i64 0
  %70 = load i32, ptr %69, align 8, !tbaa !5
  %71 = add nsw i32 %65, %70
  store i32 %71, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #7
  %72 = load i32, ptr %5, align 4, !tbaa !5
  %73 = load i32, ptr %6, align 4, !tbaa !5
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds [4 x [2 x i32]], ptr @_ZL1d, i64 0, i64 %74
  %76 = getelementptr inbounds [2 x i32], ptr %75, i64 0, i64 1
  %77 = load i32, ptr %76, align 4, !tbaa !5
  %78 = add nsw i32 %72, %77
  store i32 %78, ptr %8, align 4, !tbaa !5
  %79 = load i32, ptr %7, align 4, !tbaa !5
  %80 = load i32, ptr %8, align 4, !tbaa !5
  %81 = call noundef zeroext i1 @_Z5validii(i32 noundef %79, i32 noundef %80)
  br i1 %81, label %82, label %93

82:                                               ; preds = %64
  call void @llvm.lifetime.start.p0(i64 12, ptr %9) #7
  %83 = getelementptr inbounds %struct.Point, ptr %9, i32 0, i32 0
  %84 = load i32, ptr %6, align 4, !tbaa !5
  store i32 %84, ptr %83, align 4, !tbaa !11
  %85 = getelementptr inbounds %struct.Point, ptr %9, i32 0, i32 1
  %86 = load i32, ptr %7, align 4, !tbaa !5
  store i32 %86, ptr %85, align 4, !tbaa !13
  %87 = getelementptr inbounds %struct.Point, ptr %9, i32 0, i32 2
  %88 = load i32, ptr %8, align 4, !tbaa !5
  store i32 %88, ptr %87, align 4, !tbaa !14
  %89 = load i32, ptr @R, align 4, !tbaa !5
  %90 = add nsw i32 %89, 1
  store i32 %90, ptr @R, align 4, !tbaa !5
  %91 = sext i32 %89 to i64
  %92 = getelementptr inbounds [10000 x %struct.Point], ptr @que, i64 0, i64 %91
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %92, ptr align 4 %9, i64 12, i1 false), !tbaa.struct !15
  call void @llvm.lifetime.end.p0(i64 12, ptr %9) #7
  br label %93

93:                                               ; preds = %82, %64
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #7
  br label %94

94:                                               ; preds = %93
  %95 = load i32, ptr %6, align 4, !tbaa !5
  %96 = add nsw i32 %95, 1
  store i32 %96, ptr %6, align 4, !tbaa !5
  br label %60, !llvm.loop !16

97:                                               ; preds = %63
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #7
  store i32 1, ptr %10, align 4, !tbaa !5
  br label %98

98:                                               ; preds = %253, %97
  %99 = load i32, ptr %10, align 4, !tbaa !5
  %100 = load i32, ptr @t, align 4, !tbaa !5
  %101 = icmp sle i32 %99, %100
  br i1 %101, label %103, label %102

102:                                              ; preds = %98
  store i32 10, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #7
  br label %256

103:                                              ; preds = %98
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #7
  %104 = load i32, ptr @R, align 4, !tbaa !5
  store i32 %104, ptr %12, align 4, !tbaa !5
  br label %105

105:                                              ; preds = %168, %103
  %106 = load i32, ptr @L, align 4, !tbaa !5
  %107 = load i32, ptr @R, align 4, !tbaa !5
  %108 = icmp ne i32 %106, %107
  br i1 %108, label %109, label %169

109:                                              ; preds = %105
  call void @llvm.lifetime.start.p0(i64 12, ptr %13) #7
  %110 = load i32, ptr @L, align 4, !tbaa !5
  %111 = add nsw i32 %110, 1
  store i32 %111, ptr @L, align 4, !tbaa !5
  %112 = sext i32 %110 to i64
  %113 = getelementptr inbounds [10000 x %struct.Point], ptr @que, i64 0, i64 %112
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %13, ptr align 4 %113, i64 12, i1 false), !tbaa.struct !15
  %114 = load i32, ptr @L, align 4, !tbaa !5
  %115 = icmp sge i32 %114, 10000
  br i1 %115, label %116, label %117

116:                                              ; preds = %109
  store i32 0, ptr @L, align 4, !tbaa !5
  br label %117

117:                                              ; preds = %116, %109
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #7
  %118 = getelementptr inbounds %struct.Point, ptr %13, i32 0, i32 1
  %119 = getelementptr inbounds %struct.Point, ptr %13, i32 0, i32 2
  %120 = call i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %118, ptr noundef nonnull align 4 dereferenceable(4) %119)
  store i64 %120, ptr %14, align 4
  %121 = call noundef i64 @_ZNKSt3mapISt4pairIiiEiSt4lessIS1_ESaIS0_IKS1_iEEE5countERS4_(ptr noundef nonnull align 8 dereferenceable(48) @Hash, ptr noundef nonnull align 4 dereferenceable(8) %14)
  %122 = icmp ne i64 %121, 0
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #7
  br i1 %122, label %123, label %134

123:                                              ; preds = %117
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #7
  %124 = getelementptr inbounds %struct.Point, ptr %13, i32 0, i32 1
  %125 = getelementptr inbounds %struct.Point, ptr %13, i32 0, i32 2
  %126 = call i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %124, ptr noundef nonnull align 4 dereferenceable(4) %125)
  store i64 %126, ptr %16, align 4
  %127 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapISt4pairIiiEiSt4lessIS1_ESaIS0_IKS1_iEEEixEOS1_(ptr noundef nonnull align 8 dereferenceable(48) @Hash, ptr noundef nonnull align 4 dereferenceable(8) %16)
  %128 = load i32, ptr %127, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #7
  store i32 %128, ptr %15, align 4, !tbaa !5
  %129 = load i32, ptr %15, align 4, !tbaa !5
  %130 = sext i32 %129 to i64
  %131 = getelementptr inbounds [10000 x i32], ptr @val, i64 0, i64 %130
  %132 = load i32, ptr %131, align 4, !tbaa !5
  %133 = add nsw i32 %132, 1
  store i32 %133, ptr %131, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #7
  br label %168

134:                                              ; preds = %117
  %135 = getelementptr inbounds %struct.Point, ptr %13, i32 0, i32 0
  %136 = load i32, ptr %135, align 4, !tbaa !11
  %137 = sext i32 %136 to i64
  %138 = getelementptr inbounds [4 x [2 x i32]], ptr @_ZL1d, i64 0, i64 %137
  %139 = getelementptr inbounds [2 x i32], ptr %138, i64 0, i64 0
  %140 = load i32, ptr %139, align 8, !tbaa !5
  %141 = getelementptr inbounds %struct.Point, ptr %13, i32 0, i32 1
  %142 = load i32, ptr %141, align 4, !tbaa !13
  %143 = add nsw i32 %142, %140
  store i32 %143, ptr %141, align 4, !tbaa !13
  %144 = getelementptr inbounds %struct.Point, ptr %13, i32 0, i32 0
  %145 = load i32, ptr %144, align 4, !tbaa !11
  %146 = sext i32 %145 to i64
  %147 = getelementptr inbounds [4 x [2 x i32]], ptr @_ZL1d, i64 0, i64 %146
  %148 = getelementptr inbounds [2 x i32], ptr %147, i64 0, i64 1
  %149 = load i32, ptr %148, align 4, !tbaa !5
  %150 = getelementptr inbounds %struct.Point, ptr %13, i32 0, i32 2
  %151 = load i32, ptr %150, align 4, !tbaa !14
  %152 = add nsw i32 %151, %149
  store i32 %152, ptr %150, align 4, !tbaa !14
  %153 = getelementptr inbounds %struct.Point, ptr %13, i32 0, i32 1
  %154 = load i32, ptr %153, align 4, !tbaa !13
  %155 = getelementptr inbounds %struct.Point, ptr %13, i32 0, i32 2
  %156 = load i32, ptr %155, align 4, !tbaa !14
  %157 = call noundef zeroext i1 @_Z5validii(i32 noundef %154, i32 noundef %156)
  br i1 %157, label %158, label %167

158:                                              ; preds = %134
  %159 = load i32, ptr %12, align 4, !tbaa !5
  %160 = add nsw i32 %159, 1
  store i32 %160, ptr %12, align 4, !tbaa !5
  %161 = sext i32 %159 to i64
  %162 = getelementptr inbounds [10000 x %struct.Point], ptr @que, i64 0, i64 %161
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %162, ptr align 4 %13, i64 12, i1 false), !tbaa.struct !15
  %163 = load i32, ptr %12, align 4, !tbaa !5
  %164 = icmp sge i32 %163, 10000
  br i1 %164, label %165, label %166

165:                                              ; preds = %158
  store i32 0, ptr %12, align 4, !tbaa !5
  br label %166

166:                                              ; preds = %165, %158
  br label %167

167:                                              ; preds = %166, %134
  br label %168

168:                                              ; preds = %167, %123
  call void @llvm.lifetime.end.p0(i64 12, ptr %13) #7
  br label %105, !llvm.loop !17

169:                                              ; preds = %105
  %170 = load i32, ptr %12, align 4, !tbaa !5
  store i32 %170, ptr @R, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #7
  store i32 1, ptr %17, align 4, !tbaa !5
  br label %171

171:                                              ; preds = %249, %169
  %172 = load i32, ptr %17, align 4, !tbaa !5
  %173 = load i32, ptr @n, align 4, !tbaa !5
  %174 = icmp sle i32 %172, %173
  br i1 %174, label %176, label %175

175:                                              ; preds = %171
  store i32 15, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #7
  br label %252

176:                                              ; preds = %171
  %177 = load i32, ptr %17, align 4, !tbaa !5
  %178 = sext i32 %177 to i64
  %179 = getelementptr inbounds [10000 x i32], ptr @ans, i64 0, i64 %178
  %180 = load i32, ptr %179, align 4, !tbaa !5
  %181 = icmp ne i32 %180, 0
  br i1 %181, label %248, label %182

182:                                              ; preds = %176
  %183 = load i32, ptr %17, align 4, !tbaa !5
  %184 = sext i32 %183 to i64
  %185 = getelementptr inbounds [10000 x i32], ptr @val, i64 0, i64 %184
  %186 = load i32, ptr %185, align 4, !tbaa !5
  %187 = icmp sgt i32 %186, 4
  br i1 %187, label %188, label %248

188:                                              ; preds = %182
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #7
  %189 = load i32, ptr %17, align 4, !tbaa !5
  %190 = sext i32 %189 to i64
  %191 = getelementptr inbounds [10000 x %struct.Point], ptr @a, i64 0, i64 %190
  %192 = getelementptr inbounds %struct.Point, ptr %191, i32 0, i32 1
  %193 = load i32, ptr %17, align 4, !tbaa !5
  %194 = sext i32 %193 to i64
  %195 = getelementptr inbounds [10000 x %struct.Point], ptr @a, i64 0, i64 %194
  %196 = getelementptr inbounds %struct.Point, ptr %195, i32 0, i32 2
  %197 = call i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %192, ptr noundef nonnull align 4 dereferenceable(4) %196)
  store i64 %197, ptr %18, align 4
  %198 = call noundef i64 @_ZNSt3mapISt4pairIiiEiSt4lessIS1_ESaIS0_IKS1_iEEE5eraseERS4_(ptr noundef nonnull align 8 dereferenceable(48) @Hash, ptr noundef nonnull align 4 dereferenceable(8) %18)
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #7
  %199 = load i32, ptr %10, align 4, !tbaa !5
  %200 = load i32, ptr %17, align 4, !tbaa !5
  %201 = sext i32 %200 to i64
  %202 = getelementptr inbounds [10000 x i32], ptr @ans, i64 0, i64 %201
  store i32 %199, ptr %202, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #7
  store i32 0, ptr %19, align 4, !tbaa !5
  br label %203

203:                                              ; preds = %244, %188
  %204 = load i32, ptr %19, align 4, !tbaa !5
  %205 = icmp slt i32 %204, 4
  br i1 %205, label %207, label %206

206:                                              ; preds = %203
  store i32 18, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #7
  br label %247

207:                                              ; preds = %203
  call void @llvm.lifetime.start.p0(i64 12, ptr %20) #7
  %208 = load i32, ptr %17, align 4, !tbaa !5
  %209 = sext i32 %208 to i64
  %210 = getelementptr inbounds [10000 x %struct.Point], ptr @a, i64 0, i64 %209
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %20, ptr align 4 %210, i64 12, i1 false), !tbaa.struct !15
  %211 = load i32, ptr %19, align 4, !tbaa !5
  %212 = getelementptr inbounds %struct.Point, ptr %20, i32 0, i32 0
  store i32 %211, ptr %212, align 4, !tbaa !11
  %213 = load i32, ptr %19, align 4, !tbaa !5
  %214 = sext i32 %213 to i64
  %215 = getelementptr inbounds [4 x [2 x i32]], ptr @_ZL1d, i64 0, i64 %214
  %216 = getelementptr inbounds [2 x i32], ptr %215, i64 0, i64 0
  %217 = load i32, ptr %216, align 8, !tbaa !5
  %218 = getelementptr inbounds %struct.Point, ptr %20, i32 0, i32 1
  %219 = load i32, ptr %218, align 4, !tbaa !13
  %220 = add nsw i32 %219, %217
  store i32 %220, ptr %218, align 4, !tbaa !13
  %221 = load i32, ptr %19, align 4, !tbaa !5
  %222 = sext i32 %221 to i64
  %223 = getelementptr inbounds [4 x [2 x i32]], ptr @_ZL1d, i64 0, i64 %222
  %224 = getelementptr inbounds [2 x i32], ptr %223, i64 0, i64 1
  %225 = load i32, ptr %224, align 4, !tbaa !5
  %226 = getelementptr inbounds %struct.Point, ptr %20, i32 0, i32 2
  %227 = load i32, ptr %226, align 4, !tbaa !14
  %228 = add nsw i32 %227, %225
  store i32 %228, ptr %226, align 4, !tbaa !14
  %229 = getelementptr inbounds %struct.Point, ptr %20, i32 0, i32 1
  %230 = load i32, ptr %229, align 4, !tbaa !13
  %231 = getelementptr inbounds %struct.Point, ptr %20, i32 0, i32 2
  %232 = load i32, ptr %231, align 4, !tbaa !14
  %233 = call noundef zeroext i1 @_Z5validii(i32 noundef %230, i32 noundef %232)
  br i1 %233, label %234, label %243

234:                                              ; preds = %207
  %235 = load i32, ptr @R, align 4, !tbaa !5
  %236 = add nsw i32 %235, 1
  store i32 %236, ptr @R, align 4, !tbaa !5
  %237 = sext i32 %235 to i64
  %238 = getelementptr inbounds [10000 x %struct.Point], ptr @que, i64 0, i64 %237
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %238, ptr align 4 %20, i64 12, i1 false), !tbaa.struct !15
  %239 = load i32, ptr @R, align 4, !tbaa !5
  %240 = icmp sge i32 %239, 10000
  br i1 %240, label %241, label %242

241:                                              ; preds = %234
  store i32 0, ptr @R, align 4, !tbaa !5
  br label %242

242:                                              ; preds = %241, %234
  br label %243

243:                                              ; preds = %242, %207
  call void @llvm.lifetime.end.p0(i64 12, ptr %20) #7
  br label %244

244:                                              ; preds = %243
  %245 = load i32, ptr %19, align 4, !tbaa !5
  %246 = add nsw i32 %245, 1
  store i32 %246, ptr %19, align 4, !tbaa !5
  br label %203, !llvm.loop !18

247:                                              ; preds = %206
  br label %248

248:                                              ; preds = %247, %182, %176
  br label %249

249:                                              ; preds = %248
  %250 = load i32, ptr %17, align 4, !tbaa !5
  %251 = add nsw i32 %250, 1
  store i32 %251, ptr %17, align 4, !tbaa !5
  br label %171, !llvm.loop !19

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

253:                                              ; preds = %252
  %254 = load i32, ptr %10, align 4, !tbaa !5
  %255 = add nsw i32 %254, 1
  store i32 %255, ptr %10, align 4, !tbaa !5
  br label %98, !llvm.loop !20

256:                                              ; preds = %102
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #7
  store i32 1, ptr %21, align 4, !tbaa !5
  br label %257

257:                                              ; preds = %281, %256
  %258 = load i32, ptr %21, align 4, !tbaa !5
  %259 = load i32, ptr @n, align 4, !tbaa !5
  %260 = icmp sle i32 %258, %259
  br i1 %260, label %262, label %261

261:                                              ; preds = %257
  store i32 21, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #7
  br label %284

262:                                              ; preds = %257
  %263 = load i32, ptr %21, align 4, !tbaa !5
  %264 = sext i32 %263 to i64
  %265 = getelementptr inbounds [10000 x i32], ptr @ans, i64 0, i64 %264
  %266 = load i32, ptr %265, align 4, !tbaa !5
  %267 = icmp ne i32 %266, 0
  br i1 %267, label %274, label %268

268:                                              ; preds = %262
  %269 = load i32, ptr %21, align 4, !tbaa !5
  %270 = sext i32 %269 to i64
  %271 = getelementptr inbounds [10000 x i32], ptr @val, i64 0, i64 %270
  %272 = load i32, ptr %271, align 4, !tbaa !5
  %273 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, i32 noundef %272)
  br label %280

274:                                              ; preds = %262
  %275 = load i32, ptr %21, align 4, !tbaa !5
  %276 = sext i32 %275 to i64
  %277 = getelementptr inbounds [10000 x i32], ptr @ans, i64 0, i64 %276
  %278 = load i32, ptr %277, align 4, !tbaa !5
  %279 = call i32 (ptr, ...) @printf(ptr noundef @.str.4, i32 noundef %278)
  br label %280

280:                                              ; preds = %274, %268
  br label %281

281:                                              ; preds = %280
  %282 = load i32, ptr %21, align 4, !tbaa !5
  %283 = add nsw i32 %282, 1
  store i32 %283, ptr %21, align 4, !tbaa !5
  br label %257, !llvm.loop !21

284:                                              ; preds = %261
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #7
  br label %22, !llvm.loop !22

285:                                              ; preds = %22
  ret i32 0
}

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapISt4pairIiiEiSt4lessIS1_ESaIS0_IKS1_iEEEixEOS1_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 4 dereferenceable(8)) #5 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)) #5

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

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

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

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

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 nounwind willreturn memory(argmem: write) }
attributes #4 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { 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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #7 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!12, !6, i64 0}
!12 = !{!"_ZTS5Point", !6, i64 0, !6, i64 4, !6, i64 8}
!13 = !{!12, !6, i64 4}
!14 = !{!12, !6, i64 8}
!15 = !{i64 0, i64 4, !5, i64 4, i64 4, !5, i64 8, i64 4, !5}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !10}
!21 = distinct !{!21, !10}
!22 = distinct !{!22, !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<std::pair<int, int>, std::pair<const std::pair<int, int>, int>, std::_Select1st<std::pair<const std::pair<int, int>, int>>, std::less<std::pair<int, int>>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<std::pair<int, int>, std::pair<const std::pair<int, int>, int>, std::_Select1st<std::pair<const std::pair<int, int>, int>>, std::less<std::pair<int, 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 }
%struct.Point = type { i32, i32, i32 }
%"struct.std::pair" = type { i32, i32 }

@Hash = external dso_local global %"class.std::map", align 8
@r = external dso_local global i32, align 4
@c = external dso_local global i32, align 4
@n = external dso_local global i32, align 4
@t = external dso_local global i32, align 4
@val = external dso_local global [10000 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
@ans = external dso_local local_unnamed_addr global [10000 x i32], align 16
@a = external dso_local global [10000 x %struct.Point], align 16
@que = external dso_local local_unnamed_addr global [10000 x %struct.Point], align 16
@.str = external hidden unnamed_addr constant [9 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [5 x i8], align 1
@_ZL1d = external hidden local_unnamed_addr constant [4 x [2 x i32]], align 16
@.str.3 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [6 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z5validii(i32 noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #1 {
  %1 = alloca %"struct.std::pair", align 8
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca %struct.Point, align 4
  %5 = alloca %"struct.std::pair", align 8
  %6 = alloca %"struct.std::pair", align 8
  %7 = alloca %"struct.std::pair", align 8
  %8 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @r, ptr noundef nonnull @c, ptr noundef nonnull @n, ptr noundef nonnull @t)
  %9 = icmp eq i32 %8, 4
  br i1 %9, label %.lr.ph88, label %._crit_edge89

.lr.ph88:                                         ; preds = %0
  %10 = getelementptr inbounds i8, ptr %4, i64 4
  %11 = getelementptr inbounds i8, ptr %4, i64 8
  %12 = load i32, ptr @_ZL1d, align 16
  %13 = load i32, ptr getelementptr inbounds (i8, ptr @_ZL1d, i64 4), align 4
  %14 = load i32, ptr getelementptr inbounds (i8, ptr @_ZL1d, i64 8), align 8
  %15 = load i32, ptr getelementptr inbounds (i8, ptr @_ZL1d, i64 12), align 4
  %16 = load i32, ptr getelementptr inbounds (i8, ptr @_ZL1d, i64 16), align 16
  %17 = load i32, ptr getelementptr inbounds (i8, ptr @_ZL1d, i64 20), align 4
  %18 = load i32, ptr getelementptr inbounds (i8, ptr @_ZL1d, i64 24), align 8
  %19 = load i32, ptr getelementptr inbounds (i8, ptr @_ZL1d, i64 28), align 4
  br label %20

20:                                               ; preds = %.lr.ph88, %._crit_edge86
  store i32 0, ptr @R, align 4, !tbaa !5
  store i32 0, ptr @L, align 4, !tbaa !5
  call void @_ZNSt3mapISt4pairIiiEiSt4lessIS1_ESaIS0_IKS1_iEEE5clearEv(ptr noundef nonnull align 8 dereferenceable(48) @Hash) #7
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(40000) @ans, i8 0, i64 40000, i1 false)
  %21 = load i32, ptr @n, align 4, !tbaa !5
  %.not66 = icmp slt i32 %21, 1
  br i1 %.not66, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %.lr.ph, %20
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #7
  %22 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %2, ptr noundef nonnull %3)
  %23 = load i32, ptr %2, align 4, !tbaa !5
  %24 = add nsw i32 %12, %23
  %25 = load i32, ptr %3, align 4, !tbaa !5
  %26 = add nsw i32 %13, %25
  %27 = call noundef zeroext i1 @_Z5validii(i32 noundef %24, i32 noundef %26)
  br i1 %27, label %38, label %43

.lr.ph:                                           ; preds = %20, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 1, %20 ]
  %28 = getelementptr inbounds [10000 x %struct.Point], ptr @a, i64 0, i64 %indvars.iv
  %29 = getelementptr inbounds i8, ptr %28, i64 4
  %30 = getelementptr inbounds i8, ptr %28, i64 8
  %31 = getelementptr inbounds [10000 x i32], ptr @val, i64 0, i64 %indvars.iv
  %32 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %29, ptr noundef nonnull %30, ptr noundef nonnull %31)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #7
  %33 = call i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %29, ptr noundef nonnull align 4 dereferenceable(4) %30)
  store i64 %33, ptr %1, align 8
  %34 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapISt4pairIiiEiSt4lessIS1_ESaIS0_IKS1_iEEEixEOS1_(ptr noundef nonnull align 8 dereferenceable(48) @Hash, ptr noundef nonnull align 4 dereferenceable(8) %1)
  %35 = trunc nuw nsw i64 %indvars.iv to i32
  store i32 %35, ptr %34, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #7
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %36 = load i32, ptr @n, align 4, !tbaa !5
  %37 = sext i32 %36 to i64
  %.not.not = icmp slt i64 %indvars.iv, %37
  br i1 %.not.not, label %.lr.ph, label %._crit_edge, !llvm.loop !9

38:                                               ; preds = %._crit_edge
  %39 = load i32, ptr @R, align 4, !tbaa !5
  %40 = add nsw i32 %39, 1
  store i32 %40, ptr @R, align 4, !tbaa !5
  %41 = sext i32 %39 to i64
  %42 = getelementptr inbounds [10000 x %struct.Point], ptr @que, i64 0, i64 %41
  store i32 0, ptr %42, align 4, !tbaa !5
  %.sroa.4.0..sroa_idx = getelementptr inbounds i8, ptr %42, i64 4
  store i32 %24, ptr %.sroa.4.0..sroa_idx, align 4, !tbaa !5
  %.sroa.533.0..sroa_idx = getelementptr inbounds i8, ptr %42, i64 8
  store i32 %26, ptr %.sroa.533.0..sroa_idx, align 4, !tbaa !5
  br label %43

43:                                               ; preds = %38, %._crit_edge
  %44 = load i32, ptr %2, align 4, !tbaa !5
  %45 = add nsw i32 %14, %44
  %46 = load i32, ptr %3, align 4, !tbaa !5
  %47 = add nsw i32 %15, %46
  %48 = call noundef zeroext i1 @_Z5validii(i32 noundef %45, i32 noundef %47)
  br i1 %48, label %49, label %54

49:                                               ; preds = %43
  %50 = load i32, ptr @R, align 4, !tbaa !5
  %51 = add nsw i32 %50, 1
  store i32 %51, ptr @R, align 4, !tbaa !5
  %52 = sext i32 %50 to i64
  %53 = getelementptr inbounds [10000 x %struct.Point], ptr @que, i64 0, i64 %52
  store i32 1, ptr %53, align 4, !tbaa !5
  %.sroa.4.0..sroa_idx.1 = getelementptr inbounds i8, ptr %53, i64 4
  store i32 %45, ptr %.sroa.4.0..sroa_idx.1, align 4, !tbaa !5
  %.sroa.533.0..sroa_idx.1 = getelementptr inbounds i8, ptr %53, i64 8
  store i32 %47, ptr %.sroa.533.0..sroa_idx.1, align 4, !tbaa !5
  br label %54

54:                                               ; preds = %49, %43
  %55 = load i32, ptr %2, align 4, !tbaa !5
  %56 = add nsw i32 %16, %55
  %57 = load i32, ptr %3, align 4, !tbaa !5
  %58 = add nsw i32 %17, %57
  %59 = call noundef zeroext i1 @_Z5validii(i32 noundef %56, i32 noundef %58)
  br i1 %59, label %60, label %65

60:                                               ; preds = %54
  %61 = load i32, ptr @R, align 4, !tbaa !5
  %62 = add nsw i32 %61, 1
  store i32 %62, ptr @R, align 4, !tbaa !5
  %63 = sext i32 %61 to i64
  %64 = getelementptr inbounds [10000 x %struct.Point], ptr @que, i64 0, i64 %63
  store i32 2, ptr %64, align 4, !tbaa !5
  %.sroa.4.0..sroa_idx.2 = getelementptr inbounds i8, ptr %64, i64 4
  store i32 %56, ptr %.sroa.4.0..sroa_idx.2, align 4, !tbaa !5
  %.sroa.533.0..sroa_idx.2 = getelementptr inbounds i8, ptr %64, i64 8
  store i32 %58, ptr %.sroa.533.0..sroa_idx.2, align 4, !tbaa !5
  br label %65

65:                                               ; preds = %60, %54
  %66 = load i32, ptr %2, align 4, !tbaa !5
  %67 = add nsw i32 %18, %66
  %68 = load i32, ptr %3, align 4, !tbaa !5
  %69 = add nsw i32 %19, %68
  %70 = call noundef zeroext i1 @_Z5validii(i32 noundef %67, i32 noundef %69)
  br i1 %70, label %71, label %.preheader65

71:                                               ; preds = %65
  %72 = load i32, ptr @R, align 4, !tbaa !5
  %73 = add nsw i32 %72, 1
  store i32 %73, ptr @R, align 4, !tbaa !5
  %74 = sext i32 %72 to i64
  %75 = getelementptr inbounds [10000 x %struct.Point], ptr @que, i64 0, i64 %74
  store i32 3, ptr %75, align 4, !tbaa !5
  %.sroa.4.0..sroa_idx.3 = getelementptr inbounds i8, ptr %75, i64 4
  store i32 %67, ptr %.sroa.4.0..sroa_idx.3, align 4, !tbaa !5
  %.sroa.533.0..sroa_idx.3 = getelementptr inbounds i8, ptr %75, i64 8
  store i32 %69, ptr %.sroa.533.0..sroa_idx.3, align 4, !tbaa !5
  br label %.preheader65

.preheader65:                                     ; preds = %71, %65
  %76 = load i32, ptr @t, align 4, !tbaa !5
  %.not5880 = icmp slt i32 %76, 1
  br i1 %.not5880, label %.preheader65..preheader_crit_edge, label %.lr.ph82

.preheader65..preheader_crit_edge:                ; preds = %.preheader65
  %.pre103 = load i32, ptr @n, align 4, !tbaa !5
  br label %.preheader

.preheader:                                       ; preds = %._crit_edge79, %.preheader65..preheader_crit_edge
  %77 = phi i32 [ %.pre103, %.preheader65..preheader_crit_edge ], [ %116, %._crit_edge79 ]
  %.not5983 = icmp slt i32 %77, 1
  br i1 %.not5983, label %._crit_edge86, label %.lr.ph85

.lr.ph82:                                         ; preds = %.preheader65, %._crit_edge79
  %.05581 = phi i32 [ %117, %._crit_edge79 ], [ 1, %.preheader65 ]
  %78 = load i32, ptr @R, align 4, !tbaa !5
  %79 = load i32, ptr @L, align 4, !tbaa !5
  %.not6169 = icmp eq i32 %79, %78
  br i1 %.not6169, label %._crit_edge73, label %.lr.ph72

.lr.ph72:                                         ; preds = %.lr.ph82, %112
  %80 = phi i32 [ %113, %112 ], [ %79, %.lr.ph82 ]
  %.05470 = phi i32 [ %.1, %112 ], [ %78, %.lr.ph82 ]
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %4) #7
  %81 = add nsw i32 %80, 1
  store i32 %81, ptr @L, align 4, !tbaa !5
  %82 = sext i32 %80 to i64
  %83 = getelementptr inbounds [10000 x %struct.Point], ptr @que, i64 0, i64 %82
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(12) %4, ptr noundef nonnull align 4 dereferenceable(12) %83, i64 12, i1 false), !tbaa.struct !11
  %84 = icmp sgt i32 %80, 9998
  br i1 %84, label %85, label %86

85:                                               ; preds = %.lr.ph72
  store i32 0, ptr @L, align 4, !tbaa !5
  br label %86

86:                                               ; preds = %85, %.lr.ph72
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #7
  %87 = call i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %10, ptr noundef nonnull align 4 dereferenceable(4) %11)
  store i64 %87, ptr %5, align 8
  %88 = call noundef i64 @_ZNKSt3mapISt4pairIiiEiSt4lessIS1_ESaIS0_IKS1_iEEE5countERS4_(ptr noundef nonnull align 8 dereferenceable(48) @Hash, ptr noundef nonnull align 4 dereferenceable(8) %5)
  %.not64 = icmp eq i64 %88, 0
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #7
  br i1 %.not64, label %97, label %89

89:                                               ; preds = %86
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #7
  %90 = call i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %10, ptr noundef nonnull align 4 dereferenceable(4) %11)
  store i64 %90, ptr %6, align 8
  %91 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapISt4pairIiiEiSt4lessIS1_ESaIS0_IKS1_iEEEixEOS1_(ptr noundef nonnull align 8 dereferenceable(48) @Hash, ptr noundef nonnull align 4 dereferenceable(8) %6)
  %92 = load i32, ptr %91, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #7
  %93 = sext i32 %92 to i64
  %94 = getelementptr inbounds [10000 x i32], ptr @val, i64 0, i64 %93
  %95 = load i32, ptr %94, align 4, !tbaa !5
  %96 = add nsw i32 %95, 1
  store i32 %96, ptr %94, align 4, !tbaa !5
  br label %112

97:                                               ; preds = %86
  %98 = load i32, ptr %4, align 4, !tbaa !12
  %99 = sext i32 %98 to i64
  %100 = getelementptr inbounds [4 x [2 x i32]], ptr @_ZL1d, i64 0, i64 %99
  %101 = load <2 x i32>, ptr %100, align 8, !tbaa !5
  %102 = load <2 x i32>, ptr %10, align 4, !tbaa !5
  %103 = add nsw <2 x i32> %102, %101
  store <2 x i32> %103, ptr %10, align 4, !tbaa !5
  %104 = extractelement <2 x i32> %103, i64 0
  %105 = extractelement <2 x i32> %103, i64 1
  %106 = call noundef zeroext i1 @_Z5validii(i32 noundef %104, i32 noundef %105)
  br i1 %106, label %107, label %112

107:                                              ; preds = %97
  %108 = add nsw i32 %.05470, 1
  %109 = sext i32 %.05470 to i64
  %110 = getelementptr inbounds [10000 x %struct.Point], ptr @que, i64 0, i64 %109
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(12) %110, ptr noundef nonnull align 4 dereferenceable(12) %4, i64 12, i1 false), !tbaa.struct !11
  %111 = icmp sgt i32 %.05470, 9998
  %spec.store.select = select i1 %111, i32 0, i32 %108
  br label %112

112:                                              ; preds = %97, %107, %89
  %.1 = phi i32 [ %.05470, %89 ], [ %spec.store.select, %107 ], [ %.05470, %97 ]
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %4) #7
  %113 = load i32, ptr @L, align 4, !tbaa !5
  %114 = load i32, ptr @R, align 4, !tbaa !5
  %.not61 = icmp eq i32 %113, %114
  br i1 %.not61, label %._crit_edge73, label %.lr.ph72, !llvm.loop !14

._crit_edge73:                                    ; preds = %112, %.lr.ph82
  %.054.lcssa = phi i32 [ %78, %.lr.ph82 ], [ %.1, %112 ]
  store i32 %.054.lcssa, ptr @R, align 4, !tbaa !5
  %115 = load i32, ptr @n, align 4, !tbaa !5
  %.not6275 = icmp slt i32 %115, 1
  br i1 %.not6275, label %._crit_edge79, label %.lr.ph78

._crit_edge79:                                    ; preds = %.loopexit, %._crit_edge73
  %116 = phi i32 [ %115, %._crit_edge73 ], [ %175, %.loopexit ]
  %117 = add nuw nsw i32 %.05581, 1
  %118 = load i32, ptr @t, align 4, !tbaa !5
  %.not58.not = icmp slt i32 %.05581, %118
  br i1 %.not58.not, label %.lr.ph82, label %.preheader, !llvm.loop !15

.lr.ph78:                                         ; preds = %._crit_edge73, %.loopexit
  %119 = phi i32 [ %175, %.loopexit ], [ %115, %._crit_edge73 ]
  %indvars.iv97 = phi i64 [ %indvars.iv.next98, %.loopexit ], [ 1, %._crit_edge73 ]
  %120 = getelementptr inbounds [10000 x i32], ptr @ans, i64 0, i64 %indvars.iv97
  %121 = load i32, ptr %120, align 4, !tbaa !5
  %.not63 = icmp eq i32 %121, 0
  br i1 %.not63, label %122, label %.loopexit

122:                                              ; preds = %.lr.ph78
  %123 = getelementptr inbounds [10000 x i32], ptr @val, i64 0, i64 %indvars.iv97
  %124 = load i32, ptr %123, align 4, !tbaa !5
  %125 = icmp sgt i32 %124, 4
  br i1 %125, label %126, label %.loopexit

126:                                              ; preds = %122
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #7
  %127 = getelementptr inbounds [10000 x %struct.Point], ptr @a, i64 0, i64 %indvars.iv97
  %128 = getelementptr inbounds i8, ptr %127, i64 4
  %129 = getelementptr inbounds i8, ptr %127, i64 8
  %130 = call i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %128, ptr noundef nonnull align 4 dereferenceable(4) %129)
  store i64 %130, ptr %7, align 8
  %131 = call noundef i64 @_ZNSt3mapISt4pairIiiEiSt4lessIS1_ESaIS0_IKS1_iEEE5eraseERS4_(ptr noundef nonnull align 8 dereferenceable(48) @Hash, ptr noundef nonnull align 4 dereferenceable(8) %7)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #7
  store i32 %.05581, ptr %120, align 4, !tbaa !5
  %.sroa.5.0.copyload = load i32, ptr %128, align 4, !tbaa !5
  %.sroa.8.0.copyload = load i32, ptr %129, align 4, !tbaa !5
  %132 = add nsw i32 %12, %.sroa.5.0.copyload
  %133 = add nsw i32 %13, %.sroa.8.0.copyload
  %134 = call noundef zeroext i1 @_Z5validii(i32 noundef %132, i32 noundef %133)
  br i1 %134, label %135, label %142

135:                                              ; preds = %126
  %136 = load i32, ptr @R, align 4, !tbaa !5
  %137 = add nsw i32 %136, 1
  store i32 %137, ptr @R, align 4, !tbaa !5
  %138 = sext i32 %136 to i64
  %139 = getelementptr inbounds [10000 x %struct.Point], ptr @que, i64 0, i64 %138
  store i32 0, ptr %139, align 4, !tbaa !5
  %.sroa.5.0..sroa_idx6 = getelementptr inbounds i8, ptr %139, i64 4
  store i32 %132, ptr %.sroa.5.0..sroa_idx6, align 4, !tbaa !5
  %.sroa.8.0..sroa_idx9 = getelementptr inbounds i8, ptr %139, i64 8
  store i32 %133, ptr %.sroa.8.0..sroa_idx9, align 4, !tbaa !5
  %140 = icmp sgt i32 %136, 9998
  br i1 %140, label %141, label %142

141:                                              ; preds = %135
  store i32 0, ptr @R, align 4, !tbaa !5
  br label %142

142:                                              ; preds = %135, %141, %126
  %.sroa.5.0.copyload.1 = load i32, ptr %128, align 4, !tbaa !5
  %.sroa.8.0.copyload.1 = load i32, ptr %129, align 4, !tbaa !5
  %143 = add nsw i32 %14, %.sroa.5.0.copyload.1
  %144 = add nsw i32 %15, %.sroa.8.0.copyload.1
  %145 = call noundef zeroext i1 @_Z5validii(i32 noundef %143, i32 noundef %144)
  br i1 %145, label %146, label %153

146:                                              ; preds = %142
  %147 = load i32, ptr @R, align 4, !tbaa !5
  %148 = add nsw i32 %147, 1
  store i32 %148, ptr @R, align 4, !tbaa !5
  %149 = sext i32 %147 to i64
  %150 = getelementptr inbounds [10000 x %struct.Point], ptr @que, i64 0, i64 %149
  store i32 1, ptr %150, align 4, !tbaa !5
  %.sroa.5.0..sroa_idx6.1 = getelementptr inbounds i8, ptr %150, i64 4
  store i32 %143, ptr %.sroa.5.0..sroa_idx6.1, align 4, !tbaa !5
  %.sroa.8.0..sroa_idx9.1 = getelementptr inbounds i8, ptr %150, i64 8
  store i32 %144, ptr %.sroa.8.0..sroa_idx9.1, align 4, !tbaa !5
  %151 = icmp sgt i32 %147, 9998
  br i1 %151, label %152, label %153

152:                                              ; preds = %146
  store i32 0, ptr @R, align 4, !tbaa !5
  br label %153

153:                                              ; preds = %152, %146, %142
  %.sroa.5.0.copyload.2 = load i32, ptr %128, align 4, !tbaa !5
  %.sroa.8.0.copyload.2 = load i32, ptr %129, align 4, !tbaa !5
  %154 = add nsw i32 %16, %.sroa.5.0.copyload.2
  %155 = add nsw i32 %17, %.sroa.8.0.copyload.2
  %156 = call noundef zeroext i1 @_Z5validii(i32 noundef %154, i32 noundef %155)
  br i1 %156, label %157, label %164

157:                                              ; preds = %153
  %158 = load i32, ptr @R, align 4, !tbaa !5
  %159 = add nsw i32 %158, 1
  store i32 %159, ptr @R, align 4, !tbaa !5
  %160 = sext i32 %158 to i64
  %161 = getelementptr inbounds [10000 x %struct.Point], ptr @que, i64 0, i64 %160
  store i32 2, ptr %161, align 4, !tbaa !5
  %.sroa.5.0..sroa_idx6.2 = getelementptr inbounds i8, ptr %161, i64 4
  store i32 %154, ptr %.sroa.5.0..sroa_idx6.2, align 4, !tbaa !5
  %.sroa.8.0..sroa_idx9.2 = getelementptr inbounds i8, ptr %161, i64 8
  store i32 %155, ptr %.sroa.8.0..sroa_idx9.2, align 4, !tbaa !5
  %162 = icmp sgt i32 %158, 9998
  br i1 %162, label %163, label %164

163:                                              ; preds = %157
  store i32 0, ptr @R, align 4, !tbaa !5
  br label %164

164:                                              ; preds = %163, %157, %153
  %.sroa.5.0.copyload.3 = load i32, ptr %128, align 4, !tbaa !5
  %.sroa.8.0.copyload.3 = load i32, ptr %129, align 4, !tbaa !5
  %165 = add nsw i32 %18, %.sroa.5.0.copyload.3
  %166 = add nsw i32 %19, %.sroa.8.0.copyload.3
  %167 = call noundef zeroext i1 @_Z5validii(i32 noundef %165, i32 noundef %166)
  br i1 %167, label %168, label %.loopexit.loopexit

168:                                              ; preds = %164
  %169 = load i32, ptr @R, align 4, !tbaa !5
  %170 = add nsw i32 %169, 1
  store i32 %170, ptr @R, align 4, !tbaa !5
  %171 = sext i32 %169 to i64
  %172 = getelementptr inbounds [10000 x %struct.Point], ptr @que, i64 0, i64 %171
  store i32 3, ptr %172, align 4, !tbaa !5
  %.sroa.5.0..sroa_idx6.3 = getelementptr inbounds i8, ptr %172, i64 4
  store i32 %165, ptr %.sroa.5.0..sroa_idx6.3, align 4, !tbaa !5
  %.sroa.8.0..sroa_idx9.3 = getelementptr inbounds i8, ptr %172, i64 8
  store i32 %166, ptr %.sroa.8.0..sroa_idx9.3, align 4, !tbaa !5
  %173 = icmp sgt i32 %169, 9998
  br i1 %173, label %174, label %.loopexit.loopexit

174:                                              ; preds = %168
  store i32 0, ptr @R, align 4, !tbaa !5
  br label %.loopexit.loopexit

.loopexit.loopexit:                               ; preds = %174, %168, %164
  %.pre = load i32, ptr @n, align 4, !tbaa !5
  br label %.loopexit

.loopexit:                                        ; preds = %.loopexit.loopexit, %.lr.ph78, %122
  %175 = phi i32 [ %.pre, %.loopexit.loopexit ], [ %119, %.lr.ph78 ], [ %119, %122 ]
  %indvars.iv.next98 = add nuw nsw i64 %indvars.iv97, 1
  %176 = sext i32 %175 to i64
  %.not62.not = icmp slt i64 %indvars.iv97, %176
  br i1 %.not62.not, label %.lr.ph78, label %._crit_edge79, !llvm.loop !16

._crit_edge86:                                    ; preds = %187, %.preheader
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #7
  %177 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @r, ptr noundef nonnull @c, ptr noundef nonnull @n, ptr noundef nonnull @t)
  %178 = icmp eq i32 %177, 4
  br i1 %178, label %20, label %._crit_edge89, !llvm.loop !17

.lr.ph85:                                         ; preds = %.preheader, %187
  %indvars.iv100 = phi i64 [ %indvars.iv.next101, %187 ], [ 1, %.preheader ]
  %179 = getelementptr inbounds [10000 x i32], ptr @ans, i64 0, i64 %indvars.iv100
  %180 = load i32, ptr %179, align 4, !tbaa !5
  %.not60 = icmp eq i32 %180, 0
  br i1 %.not60, label %181, label %185

181:                                              ; preds = %.lr.ph85
  %182 = getelementptr inbounds [10000 x i32], ptr @val, i64 0, i64 %indvars.iv100
  %183 = load i32, ptr %182, align 4, !tbaa !5
  %184 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %183)
  br label %187

185:                                              ; preds = %.lr.ph85
  %186 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %180)
  br label %187

187:                                              ; preds = %181, %185
  %indvars.iv.next101 = add nuw nsw i64 %indvars.iv100, 1
  %188 = load i32, ptr @n, align 4, !tbaa !5
  %189 = sext i32 %188 to i64
  %.not59.not = icmp slt i64 %indvars.iv100, %189
  br i1 %.not59.not, label %.lr.ph85, label %._crit_edge86, !llvm.loop !18

._crit_edge89:                                    ; preds = %._crit_edge86, %0
  ret i32 0
}

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapISt4pairIiiEiSt4lessIS1_ESaIS0_IKS1_iEEEixEOS1_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 4 dereferenceable(8)) local_unnamed_addr #5 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 #5

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

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

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

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

; 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 nounwind willreturn memory(argmem: write) }
attributes #4 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { 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 nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #7 = { nounwind }

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

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


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