; LLVM IR from reyadussalahin/problem-solving :: graph/lca/codeforces/F191C (Solution)

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::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.std::pair" = type { i32, i32 }

@par = external dso_local global [100010 x i32], align 16
@seen = external dso_local global [100010 x i32], align 16
@od = external dso_local global [100010 x i32], align 16
@qu = external dso_local global [100010 x i32], align 16
@qw = external dso_local global [100010 x i32], align 16
@sp = external dso_local global [100010 x [18 x i32]], align 16
@cnt = external dso_local global [100010 x i32], align 16
@res = external dso_local global [100010 x i32], align 16
@g = external dso_local global [100010 x %"class.std::vector"], align 16
@mp = external dso_local global %"class.std::map", align 8
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [2 x i8], align 1

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

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

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #3 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca %"struct.std::pair", align 4
  %7 = alloca i32, 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 i32, align 4
  %14 = alloca i32, align 4
  %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 %"struct.std::pair", align 4
  %22 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  %23 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %2)
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #6
  store i32 1, ptr %3, align 4, !tbaa !5
  br label %24

24:                                               ; preds = %42, %0
  %25 = load i32, ptr %3, align 4, !tbaa !5
  %26 = load i32, ptr %2, align 4, !tbaa !5
  %27 = icmp slt i32 %25, %26
  br i1 %27, label %29, label %28

28:                                               ; preds = %24
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #6
  br label %45

29:                                               ; preds = %24
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  %30 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.3, ptr noundef %4, ptr noundef %5)
  %31 = load i32, ptr %4, align 4, !tbaa !5
  %32 = sext i32 %31 to i64
  %33 = getelementptr inbounds [100010 x %"class.std::vector"], ptr @g, i64 0, i64 %32
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %33, ptr noundef nonnull align 4 dereferenceable(4) %5)
  %34 = load i32, ptr %5, align 4, !tbaa !5
  %35 = sext i32 %34 to i64
  %36 = getelementptr inbounds [100010 x %"class.std::vector"], ptr @g, i64 0, i64 %35
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %36, ptr noundef nonnull align 4 dereferenceable(4) %4)
  %37 = load i32, ptr %3, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #6
  %38 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %4, ptr noundef nonnull align 4 dereferenceable(4) %5)
  %39 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %4, ptr noundef nonnull align 4 dereferenceable(4) %5)
  %40 = call i64 @_ZSt9make_pairIRKiS1_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS3_INS4_IT0_E4typeEE6__typeEEOS5_OSA_(ptr noundef nonnull align 4 dereferenceable(4) %38, ptr noundef nonnull align 4 dereferenceable(4) %39)
  store i64 %40, ptr %6, align 4
  %41 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapISt4pairIiiEiSt4lessIS1_ESaIS0_IKS1_iEEEixEOS1_(ptr noundef nonnull align 8 dereferenceable(48) @mp, ptr noundef nonnull align 4 dereferenceable(8) %6)
  store i32 %37, ptr %41, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  br label %42

42:                                               ; preds = %29
  %43 = load i32, ptr %3, align 4, !tbaa !5
  %44 = add nsw i32 %43, 1
  store i32 %44, ptr %3, align 4, !tbaa !5
  br label %24, !llvm.loop !9

45:                                               ; preds = %28
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  store i32 0, ptr %7, align 4, !tbaa !5
  br label %46

46:                                               ; preds = %76, %45
  %47 = load i32, ptr %7, align 4, !tbaa !5
  %48 = load i32, ptr %2, align 4, !tbaa !5
  %49 = icmp sle i32 %47, %48
  br i1 %49, label %51, label %50

50:                                               ; preds = %46
  store i32 5, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  br label %79

51:                                               ; preds = %46
  %52 = load i32, ptr %7, align 4, !tbaa !5
  %53 = sext i32 %52 to i64
  %54 = getelementptr inbounds [100010 x i32], ptr @seen, i64 0, i64 %53
  store i32 0, ptr %54, align 4, !tbaa !5
  %55 = load i32, ptr %7, align 4, !tbaa !5
  %56 = sext i32 %55 to i64
  %57 = getelementptr inbounds [100010 x i32], ptr @od, i64 0, i64 %56
  store i32 0, ptr %57, align 4, !tbaa !5
  %58 = load i32, ptr %7, align 4, !tbaa !5
  %59 = sext i32 %58 to i64
  %60 = getelementptr inbounds [100010 x i32], ptr @cnt, i64 0, i64 %59
  store i32 0, ptr %60, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  store i32 0, ptr %9, align 4, !tbaa !5
  br label %61

61:                                               ; preds = %72, %51
  %62 = load i32, ptr %9, align 4, !tbaa !5
  %63 = icmp slt i32 %62, 18
  br i1 %63, label %65, label %64

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

65:                                               ; preds = %61
  %66 = load i32, ptr %7, align 4, !tbaa !5
  %67 = sext i32 %66 to i64
  %68 = getelementptr inbounds [100010 x [18 x i32]], ptr @sp, i64 0, i64 %67
  %69 = load i32, ptr %9, align 4, !tbaa !5
  %70 = sext i32 %69 to i64
  %71 = getelementptr inbounds [18 x i32], ptr %68, i64 0, i64 %70
  store i32 -1, ptr %71, align 4, !tbaa !5
  br label %72

72:                                               ; preds = %65
  %73 = load i32, ptr %9, align 4, !tbaa !5
  %74 = add nsw i32 %73, 1
  store i32 %74, ptr %9, align 4, !tbaa !5
  br label %61, !llvm.loop !11

75:                                               ; preds = %64
  br label %76

76:                                               ; preds = %75
  %77 = load i32, ptr %7, align 4, !tbaa !5
  %78 = add nsw i32 %77, 1
  store i32 %78, ptr %7, align 4, !tbaa !5
  br label %46, !llvm.loop !12

79:                                               ; preds = %50
  call void @_Z3dfsiii(i32 noundef 1, i32 noundef -1, i32 noundef 0)
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  %80 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %10)
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  store i32 0, ptr %11, align 4, !tbaa !5
  br label %81

81:                                               ; preds = %106, %79
  %82 = load i32, ptr %11, align 4, !tbaa !5
  %83 = load i32, ptr %10, align 4, !tbaa !5
  %84 = icmp slt i32 %82, %83
  br i1 %84, label %86, label %85

85:                                               ; preds = %81
  store i32 11, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  br label %109

86:                                               ; preds = %81
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #6
  %87 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.3, ptr noundef %12, ptr noundef %13)
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #6
  %88 = load i32, ptr %12, align 4, !tbaa !5
  %89 = load i32, ptr %13, align 4, !tbaa !5
  %90 = call noundef i32 @_Z3lcaii(i32 noundef %88, i32 noundef %89)
  store i32 %90, ptr %14, align 4, !tbaa !5
  %91 = load i32, ptr %12, align 4, !tbaa !5
  %92 = sext i32 %91 to i64
  %93 = getelementptr inbounds [100010 x i32], ptr @cnt, i64 0, i64 %92
  %94 = load i32, ptr %93, align 4, !tbaa !5
  %95 = add nsw i32 %94, 1
  store i32 %95, ptr %93, align 4, !tbaa !5
  %96 = load i32, ptr %13, align 4, !tbaa !5
  %97 = sext i32 %96 to i64
  %98 = getelementptr inbounds [100010 x i32], ptr @cnt, i64 0, i64 %97
  %99 = load i32, ptr %98, align 4, !tbaa !5
  %100 = add nsw i32 %99, 1
  store i32 %100, ptr %98, align 4, !tbaa !5
  %101 = load i32, ptr %14, align 4, !tbaa !5
  %102 = sext i32 %101 to i64
  %103 = getelementptr inbounds [100010 x i32], ptr @cnt, i64 0, i64 %102
  %104 = load i32, ptr %103, align 4, !tbaa !5
  %105 = sub nsw i32 %104, 2
  store i32 %105, ptr %103, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  br label %106

106:                                              ; preds = %86
  %107 = load i32, ptr %11, align 4, !tbaa !5
  %108 = add nsw i32 %107, 1
  store i32 %108, ptr %11, align 4, !tbaa !5
  br label %81, !llvm.loop !13

109:                                              ; preds = %85
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #6
  store i32 0, ptr %15, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #6
  store i32 0, ptr %16, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #6
  store i32 1, ptr %17, align 4, !tbaa !5
  br label %110

110:                                              ; preds = %135, %109
  %111 = load i32, ptr %17, align 4, !tbaa !5
  %112 = load i32, ptr %2, align 4, !tbaa !5
  %113 = icmp sle i32 %111, %112
  br i1 %113, label %115, label %114

114:                                              ; preds = %110
  store i32 14, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #6
  br label %138

115:                                              ; preds = %110
  %116 = load i32, ptr %17, align 4, !tbaa !5
  %117 = sext i32 %116 to i64
  %118 = getelementptr inbounds [100010 x i32], ptr @od, i64 0, i64 %117
  %119 = load i32, ptr %118, align 4, !tbaa !5
  %120 = icmp ne i32 %119, 0
  br i1 %120, label %134, label %121

121:                                              ; preds = %115
  %122 = load i32, ptr %17, align 4, !tbaa !5
  %123 = sext i32 %122 to i64
  %124 = getelementptr inbounds [100010 x i32], ptr @cnt, i64 0, i64 %123
  %125 = load i32, ptr %124, align 4, !tbaa !5
  %126 = load i32, ptr %16, align 4, !tbaa !5
  %127 = sext i32 %126 to i64
  %128 = getelementptr inbounds [100010 x i32], ptr @qw, i64 0, i64 %127
  store i32 %125, ptr %128, align 4, !tbaa !5
  %129 = load i32, ptr %17, align 4, !tbaa !5
  %130 = load i32, ptr %16, align 4, !tbaa !5
  %131 = add nsw i32 %130, 1
  store i32 %131, ptr %16, align 4, !tbaa !5
  %132 = sext i32 %130 to i64
  %133 = getelementptr inbounds [100010 x i32], ptr @qu, i64 0, i64 %132
  store i32 %129, ptr %133, align 4, !tbaa !5
  br label %134

134:                                              ; preds = %121, %115
  br label %135

135:                                              ; preds = %134
  %136 = load i32, ptr %17, align 4, !tbaa !5
  %137 = add nsw i32 %136, 1
  store i32 %137, ptr %17, align 4, !tbaa !5
  br label %110, !llvm.loop !14

138:                                              ; preds = %114
  br label %139

139:                                              ; preds = %198, %138
  %140 = load i32, ptr %15, align 4, !tbaa !5
  %141 = load i32, ptr %16, align 4, !tbaa !5
  %142 = icmp ne i32 %140, %141
  br i1 %142, label %143, label %199

143:                                              ; preds = %139
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #6
  %144 = load i32, ptr %15, align 4, !tbaa !5
  %145 = sext i32 %144 to i64
  %146 = getelementptr inbounds [100010 x i32], ptr @qw, i64 0, i64 %145
  %147 = load i32, ptr %146, align 4, !tbaa !5
  store i32 %147, ptr %18, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #6
  %148 = load i32, ptr %15, align 4, !tbaa !5
  %149 = add nsw i32 %148, 1
  store i32 %149, ptr %15, align 4, !tbaa !5
  %150 = sext i32 %148 to i64
  %151 = getelementptr inbounds [100010 x i32], ptr @qu, i64 0, i64 %150
  %152 = load i32, ptr %151, align 4, !tbaa !5
  store i32 %152, ptr %19, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #6
  %153 = load i32, ptr %19, align 4, !tbaa !5
  %154 = sext i32 %153 to i64
  %155 = getelementptr inbounds [100010 x i32], ptr @par, i64 0, i64 %154
  %156 = load i32, ptr %155, align 4, !tbaa !5
  store i32 %156, ptr %20, align 4, !tbaa !5
  %157 = load i32, ptr %20, align 4, !tbaa !5
  %158 = icmp ne i32 %157, -1
  br i1 %158, label %159, label %198

159:                                              ; preds = %143
  %160 = load i32, ptr %18, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #6
  %161 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %19, ptr noundef nonnull align 4 dereferenceable(4) %20)
  %162 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %19, ptr noundef nonnull align 4 dereferenceable(4) %20)
  %163 = call i64 @_ZSt9make_pairIRKiS1_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS3_INS4_IT0_E4typeEE6__typeEEOS5_OSA_(ptr noundef nonnull align 4 dereferenceable(4) %161, ptr noundef nonnull align 4 dereferenceable(4) %162)
  store i64 %163, ptr %21, align 4
  %164 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapISt4pairIiiEiSt4lessIS1_ESaIS0_IKS1_iEEEixEOS1_(ptr noundef nonnull align 8 dereferenceable(48) @mp, ptr noundef nonnull align 4 dereferenceable(8) %21)
  %165 = load i32, ptr %164, align 4, !tbaa !5
  %166 = sext i32 %165 to i64
  %167 = getelementptr inbounds [100010 x i32], ptr @res, i64 0, i64 %166
  store i32 %160, ptr %167, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #6
  %168 = load i32, ptr %18, align 4, !tbaa !5
  %169 = load i32, ptr %20, align 4, !tbaa !5
  %170 = sext i32 %169 to i64
  %171 = getelementptr inbounds [100010 x i32], ptr @cnt, i64 0, i64 %170
  %172 = load i32, ptr %171, align 4, !tbaa !5
  %173 = add nsw i32 %172, %168
  store i32 %173, ptr %171, align 4, !tbaa !5
  %174 = load i32, ptr %20, align 4, !tbaa !5
  %175 = sext i32 %174 to i64
  %176 = getelementptr inbounds [100010 x i32], ptr @od, i64 0, i64 %175
  %177 = load i32, ptr %176, align 4, !tbaa !5
  %178 = add nsw i32 %177, -1
  store i32 %178, ptr %176, align 4, !tbaa !5
  %179 = load i32, ptr %20, align 4, !tbaa !5
  %180 = sext i32 %179 to i64
  %181 = getelementptr inbounds [100010 x i32], ptr @od, i64 0, i64 %180
  %182 = load i32, ptr %181, align 4, !tbaa !5
  %183 = icmp eq i32 %182, 0
  br i1 %183, label %184, label %197

184:                                              ; preds = %159
  %185 = load i32, ptr %20, align 4, !tbaa !5
  %186 = sext i32 %185 to i64
  %187 = getelementptr inbounds [100010 x i32], ptr @cnt, i64 0, i64 %186
  %188 = load i32, ptr %187, align 4, !tbaa !5
  %189 = load i32, ptr %16, align 4, !tbaa !5
  %190 = sext i32 %189 to i64
  %191 = getelementptr inbounds [100010 x i32], ptr @qw, i64 0, i64 %190
  store i32 %188, ptr %191, align 4, !tbaa !5
  %192 = load i32, ptr %20, align 4, !tbaa !5
  %193 = load i32, ptr %16, align 4, !tbaa !5
  %194 = add nsw i32 %193, 1
  store i32 %194, ptr %16, align 4, !tbaa !5
  %195 = sext i32 %193 to i64
  %196 = getelementptr inbounds [100010 x i32], ptr @qu, i64 0, i64 %195
  store i32 %192, ptr %196, align 4, !tbaa !5
  br label %197

197:                                              ; preds = %184, %159
  br label %198

198:                                              ; preds = %197, %143
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #6
  br label %139, !llvm.loop !15

199:                                              ; preds = %139
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #6
  store i32 1, ptr %22, align 4, !tbaa !5
  br label %200

200:                                              ; preds = %211, %199
  %201 = load i32, ptr %22, align 4, !tbaa !5
  %202 = load i32, ptr %2, align 4, !tbaa !5
  %203 = icmp slt i32 %201, %202
  br i1 %203, label %205, label %204

204:                                              ; preds = %200
  store i32 19, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #6
  br label %214

205:                                              ; preds = %200
  %206 = load i32, ptr %22, align 4, !tbaa !5
  %207 = sext i32 %206 to i64
  %208 = getelementptr inbounds [100010 x i32], ptr @res, i64 0, i64 %207
  %209 = load i32, ptr %208, align 4, !tbaa !5
  %210 = call i32 (ptr, ...) @printf(ptr noundef @.str.4, i32 noundef %209)
  br label %211

211:                                              ; preds = %205
  %212 = load i32, ptr %22, align 4, !tbaa !5
  %213 = add nsw i32 %212, 1
  store i32 %213, ptr %22, align 4, !tbaa !5
  br label %200, !llvm.loop !16

214:                                              ; preds = %204
  %215 = call i32 (ptr, ...) @printf(ptr noundef @.str.5)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #6
  %216 = load i32, ptr %1, align 4
  ret i32 %216
}

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

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

; Function Attrs: 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)) #0 align 2

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

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

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

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

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !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::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::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.std::pair" = type { i32, i32 }

@par = external dso_local local_unnamed_addr global [100010 x i32], align 16
@seen = external dso_local local_unnamed_addr global [100010 x i32], align 16
@od = external dso_local local_unnamed_addr global [100010 x i32], align 16
@qu = external dso_local local_unnamed_addr global [100010 x i32], align 16
@qw = external dso_local local_unnamed_addr global [100010 x i32], align 16
@sp = external dso_local local_unnamed_addr global [100010 x [18 x i32]], align 16
@cnt = external dso_local local_unnamed_addr global [100010 x i32], align 16
@res = external dso_local local_unnamed_addr global [100010 x i32], align 16
@g = external dso_local global [100010 x %"class.std::vector"], align 16
@mp = external dso_local global %"class.std::map", align 8
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [2 x i8], align 1

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

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

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #3 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca %"struct.std::pair", align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca %"struct.std::pair", align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #7
  %11 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1)
  %12 = load i32, ptr %1, align 4, !tbaa !5
  %13 = icmp sgt i32 %12, 1
  br i1 %13, label %.lr.ph, label %.preheader47

.preheader47:                                     ; preds = %.lr.ph, %0
  %.lcssa = phi i32 [ %12, %0 ], [ %30, %.lr.ph ]
  %.not50 = icmp slt i32 %.lcssa, 0
  br i1 %.not50, label %._crit_edge, label %.lr.ph52.preheader

.lr.ph52.preheader:                               ; preds = %.preheader47
  %14 = add nuw i32 %.lcssa, 1
  %15 = zext i32 %14 to i64
  %16 = shl nuw nsw i64 %15, 2
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) @seen, i8 0, i64 %16, i1 false), !tbaa !5
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) @od, i8 0, i64 %16, i1 false), !tbaa !5
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) @cnt, i8 0, i64 %16, i1 false), !tbaa !5
  %17 = mul nuw nsw i64 %15, 72
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) @sp, i8 -1, i64 %17, i1 false), !tbaa !5
  br label %._crit_edge

.lr.ph:                                           ; preds = %0, %.lr.ph
  %.03748 = phi i32 [ %29, %.lr.ph ], [ 1, %0 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #7
  %18 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull %2, ptr noundef nonnull %3)
  %19 = load i32, ptr %2, align 4, !tbaa !5
  %20 = sext i32 %19 to i64
  %21 = getelementptr inbounds [100010 x %"class.std::vector"], ptr @g, i64 0, i64 %20
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %21, ptr noundef nonnull align 4 dereferenceable(4) %3)
  %22 = load i32, ptr %3, align 4, !tbaa !5
  %23 = sext i32 %22 to i64
  %24 = getelementptr inbounds [100010 x %"class.std::vector"], ptr @g, i64 0, i64 %23
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %24, ptr noundef nonnull align 4 dereferenceable(4) %2)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #7
  %25 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %2, ptr noundef nonnull align 4 dereferenceable(4) %3)
  %26 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %2, ptr noundef nonnull align 4 dereferenceable(4) %3)
  %27 = call i64 @_ZSt9make_pairIRKiS1_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS3_INS4_IT0_E4typeEE6__typeEEOS5_OSA_(ptr noundef nonnull align 4 dereferenceable(4) %25, ptr noundef nonnull align 4 dereferenceable(4) %26)
  store i64 %27, ptr %4, align 8
  %28 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapISt4pairIiiEiSt4lessIS1_ESaIS0_IKS1_iEEEixEOS1_(ptr noundef nonnull align 8 dereferenceable(48) @mp, ptr noundef nonnull align 4 dereferenceable(8) %4)
  store i32 %.03748, ptr %28, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #7
  %29 = add nuw nsw i32 %.03748, 1
  %30 = load i32, ptr %1, align 4, !tbaa !5
  %31 = icmp slt i32 %29, %30
  br i1 %31, label %.lr.ph, label %.preheader47, !llvm.loop !9

._crit_edge:                                      ; preds = %.lr.ph52.preheader, %.preheader47
  call void @_Z3dfsiii(i32 noundef 1, i32 noundef -1, i32 noundef 0)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #7
  %32 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %5)
  %33 = load i32, ptr %5, align 4, !tbaa !5
  %34 = icmp sgt i32 %33, 0
  br i1 %34, label %.lr.ph55, label %.preheader46

.preheader46:                                     ; preds = %.lr.ph55, %._crit_edge
  %35 = load i32, ptr %1, align 4, !tbaa !5
  %.not4156 = icmp slt i32 %35, 1
  br i1 %.not4156, label %._crit_edge67, label %.lr.ph59.preheader

.lr.ph59.preheader:                               ; preds = %.preheader46
  %36 = zext nneg i32 %35 to i64
  %xtraiter = and i64 %36, 1
  %37 = icmp eq i32 %35, 1
  br i1 %37, label %.preheader45.unr-lcssa, label %.lr.ph59.preheader.new

.lr.ph59.preheader.new:                           ; preds = %.lr.ph59.preheader
  %unroll_iter = and i64 %36, 2147483646
  br label %.lr.ph59

.lr.ph55:                                         ; preds = %._crit_edge, %.lr.ph55
  %.03853 = phi i32 [ %56, %.lr.ph55 ], [ 0, %._crit_edge ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #7
  %38 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull %6, ptr noundef nonnull %7)
  %39 = load i32, ptr %6, align 4, !tbaa !5
  %40 = load i32, ptr %7, align 4, !tbaa !5
  %41 = call noundef i32 @_Z3lcaii(i32 noundef %39, i32 noundef %40)
  %42 = load i32, ptr %6, align 4, !tbaa !5
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds [100010 x i32], ptr @cnt, i64 0, i64 %43
  %45 = load i32, ptr %44, align 4, !tbaa !5
  %46 = add nsw i32 %45, 1
  store i32 %46, ptr %44, align 4, !tbaa !5
  %47 = load i32, ptr %7, align 4, !tbaa !5
  %48 = sext i32 %47 to i64
  %49 = getelementptr inbounds [100010 x i32], ptr @cnt, i64 0, i64 %48
  %50 = load i32, ptr %49, align 4, !tbaa !5
  %51 = add nsw i32 %50, 1
  store i32 %51, ptr %49, align 4, !tbaa !5
  %52 = sext i32 %41 to i64
  %53 = getelementptr inbounds [100010 x i32], ptr @cnt, i64 0, i64 %52
  %54 = load i32, ptr %53, align 4, !tbaa !5
  %55 = add nsw i32 %54, -2
  store i32 %55, ptr %53, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #7
  %56 = add nuw nsw i32 %.03853, 1
  %57 = load i32, ptr %5, align 4, !tbaa !5
  %58 = icmp slt i32 %56, %57
  br i1 %58, label %.lr.ph55, label %.preheader46, !llvm.loop !11

.preheader45.unr-lcssa:                           ; preds = %89, %.lr.ph59.preheader
  %.1.lcssa.ph = phi i32 [ poison, %.lr.ph59.preheader ], [ %.1.1, %89 ]
  %indvars.iv.unr = phi i64 [ 1, %.lr.ph59.preheader ], [ %indvars.iv.next.1, %89 ]
  %.03557.unr = phi i32 [ 0, %.lr.ph59.preheader ], [ %.1.1, %89 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.preheader45, label %.lr.ph59.epil

.lr.ph59.epil:                                    ; preds = %.preheader45.unr-lcssa
  %59 = getelementptr inbounds [100010 x i32], ptr @od, i64 0, i64 %indvars.iv.unr
  %60 = load i32, ptr %59, align 4, !tbaa !5
  %.not44.epil = icmp eq i32 %60, 0
  br i1 %.not44.epil, label %61, label %.preheader45

61:                                               ; preds = %.lr.ph59.epil
  %62 = getelementptr inbounds [100010 x i32], ptr @cnt, i64 0, i64 %indvars.iv.unr
  %63 = load i32, ptr %62, align 4, !tbaa !5
  %64 = sext i32 %.03557.unr to i64
  %65 = getelementptr inbounds [100010 x i32], ptr @qw, i64 0, i64 %64
  store i32 %63, ptr %65, align 4, !tbaa !5
  %66 = add nsw i32 %.03557.unr, 1
  %67 = getelementptr inbounds [100010 x i32], ptr @qu, i64 0, i64 %64
  %68 = trunc nuw nsw i64 %indvars.iv.unr to i32
  store i32 %68, ptr %67, align 4, !tbaa !5
  br label %.preheader45

.preheader45:                                     ; preds = %.lr.ph59.epil, %61, %.preheader45.unr-lcssa
  %.1.lcssa = phi i32 [ %.1.lcssa.ph, %.preheader45.unr-lcssa ], [ %.03557.unr, %.lr.ph59.epil ], [ %66, %61 ]
  %.not4261 = icmp eq i32 %.1.lcssa, 0
  br i1 %.not4261, label %.preheader, label %.lr.ph64

.lr.ph59:                                         ; preds = %89, %.lr.ph59.preheader.new
  %indvars.iv = phi i64 [ 1, %.lr.ph59.preheader.new ], [ %indvars.iv.next.1, %89 ]
  %.03557 = phi i32 [ 0, %.lr.ph59.preheader.new ], [ %.1.1, %89 ]
  %niter = phi i64 [ 0, %.lr.ph59.preheader.new ], [ %niter.next.1, %89 ]
  %69 = getelementptr inbounds [100010 x i32], ptr @od, i64 0, i64 %indvars.iv
  %70 = load i32, ptr %69, align 4, !tbaa !5
  %.not44 = icmp eq i32 %70, 0
  br i1 %.not44, label %71, label %.lr.ph59.1

71:                                               ; preds = %.lr.ph59
  %72 = getelementptr inbounds [100010 x i32], ptr @cnt, i64 0, i64 %indvars.iv
  %73 = load i32, ptr %72, align 4, !tbaa !5
  %74 = sext i32 %.03557 to i64
  %75 = getelementptr inbounds [100010 x i32], ptr @qw, i64 0, i64 %74
  store i32 %73, ptr %75, align 4, !tbaa !5
  %76 = add nsw i32 %.03557, 1
  %77 = getelementptr inbounds [100010 x i32], ptr @qu, i64 0, i64 %74
  %78 = trunc nuw nsw i64 %indvars.iv to i32
  store i32 %78, ptr %77, align 4, !tbaa !5
  br label %.lr.ph59.1

.lr.ph59.1:                                       ; preds = %.lr.ph59, %71
  %.1 = phi i32 [ %.03557, %.lr.ph59 ], [ %76, %71 ]
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %79 = getelementptr inbounds [100010 x i32], ptr @od, i64 0, i64 %indvars.iv.next
  %80 = load i32, ptr %79, align 4, !tbaa !5
  %.not44.1 = icmp eq i32 %80, 0
  br i1 %.not44.1, label %81, label %89

81:                                               ; preds = %.lr.ph59.1
  %82 = getelementptr inbounds [100010 x i32], ptr @cnt, i64 0, i64 %indvars.iv.next
  %83 = load i32, ptr %82, align 4, !tbaa !5
  %84 = sext i32 %.1 to i64
  %85 = getelementptr inbounds [100010 x i32], ptr @qw, i64 0, i64 %84
  store i32 %83, ptr %85, align 4, !tbaa !5
  %86 = add nsw i32 %.1, 1
  %87 = getelementptr inbounds [100010 x i32], ptr @qu, i64 0, i64 %84
  %88 = trunc nuw nsw i64 %indvars.iv.next to i32
  store i32 %88, ptr %87, align 4, !tbaa !5
  br label %89

89:                                               ; preds = %81, %.lr.ph59.1
  %.1.1 = phi i32 [ %.1, %.lr.ph59.1 ], [ %86, %81 ]
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %.preheader45.unr-lcssa, label %.lr.ph59, !llvm.loop !12

.preheader.loopexit:                              ; preds = %121
  %.pre = load i32, ptr %1, align 4, !tbaa !5
  br label %.preheader

.preheader:                                       ; preds = %.preheader.loopexit, %.preheader45
  %90 = phi i32 [ %.pre, %.preheader.loopexit ], [ %35, %.preheader45 ]
  %91 = icmp sgt i32 %90, 1
  br i1 %91, label %.lr.ph66, label %._crit_edge67

.lr.ph64:                                         ; preds = %.preheader45, %121
  %indvars.iv72 = phi i64 [ %indvars.iv.next73, %121 ], [ 0, %.preheader45 ]
  %.263 = phi i32 [ %.3, %121 ], [ %.1.lcssa, %.preheader45 ]
  %92 = getelementptr inbounds [100010 x i32], ptr @qw, i64 0, i64 %indvars.iv72
  %93 = load i32, ptr %92, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #7
  %indvars.iv.next73 = add nuw nsw i64 %indvars.iv72, 1
  %94 = getelementptr inbounds [100010 x i32], ptr @qu, i64 0, i64 %indvars.iv72
  %95 = load i32, ptr %94, align 4, !tbaa !5
  store i32 %95, ptr %8, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %9) #7
  %96 = sext i32 %95 to i64
  %97 = getelementptr inbounds [100010 x i32], ptr @par, i64 0, i64 %96
  %98 = load i32, ptr %97, align 4, !tbaa !5
  store i32 %98, ptr %9, align 4, !tbaa !5
  %.not43 = icmp eq i32 %98, -1
  br i1 %.not43, label %121, label %99

99:                                               ; preds = %.lr.ph64
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %10) #7
  %100 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %8, ptr noundef nonnull align 4 dereferenceable(4) %9)
  %101 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %8, ptr noundef nonnull align 4 dereferenceable(4) %9)
  %102 = call i64 @_ZSt9make_pairIRKiS1_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS3_INS4_IT0_E4typeEE6__typeEEOS5_OSA_(ptr noundef nonnull align 4 dereferenceable(4) %100, ptr noundef nonnull align 4 dereferenceable(4) %101)
  store i64 %102, ptr %10, align 8
  %103 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapISt4pairIiiEiSt4lessIS1_ESaIS0_IKS1_iEEEixEOS1_(ptr noundef nonnull align 8 dereferenceable(48) @mp, ptr noundef nonnull align 4 dereferenceable(8) %10)
  %104 = load i32, ptr %103, align 4, !tbaa !5
  %105 = sext i32 %104 to i64
  %106 = getelementptr inbounds [100010 x i32], ptr @res, i64 0, i64 %105
  store i32 %93, ptr %106, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #7
  %107 = load i32, ptr %9, align 4, !tbaa !5
  %108 = sext i32 %107 to i64
  %109 = getelementptr inbounds [100010 x i32], ptr @cnt, i64 0, i64 %108
  %110 = load i32, ptr %109, align 4, !tbaa !5
  %111 = add nsw i32 %110, %93
  store i32 %111, ptr %109, align 4, !tbaa !5
  %112 = getelementptr inbounds [100010 x i32], ptr @od, i64 0, i64 %108
  %113 = load i32, ptr %112, align 4, !tbaa !5
  %114 = add nsw i32 %113, -1
  store i32 %114, ptr %112, align 4, !tbaa !5
  %115 = icmp eq i32 %114, 0
  br i1 %115, label %116, label %121

116:                                              ; preds = %99
  %117 = sext i32 %.263 to i64
  %118 = getelementptr inbounds [100010 x i32], ptr @qw, i64 0, i64 %117
  store i32 %111, ptr %118, align 4, !tbaa !5
  %119 = add nsw i32 %.263, 1
  %120 = getelementptr inbounds [100010 x i32], ptr @qu, i64 0, i64 %117
  store i32 %107, ptr %120, align 4, !tbaa !5
  br label %121

121:                                              ; preds = %99, %116, %.lr.ph64
  %.3 = phi i32 [ %119, %116 ], [ %.263, %99 ], [ %.263, %.lr.ph64 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %9) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #7
  %122 = zext i32 %.3 to i64
  %.not42 = icmp eq i64 %indvars.iv.next73, %122
  br i1 %.not42, label %.preheader.loopexit, label %.lr.ph64, !llvm.loop !13

._crit_edge67:                                    ; preds = %.lr.ph66, %.preheader46, %.preheader
  %123 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #7
  ret i32 0

.lr.ph66:                                         ; preds = %.preheader, %.lr.ph66
  %indvars.iv75 = phi i64 [ %indvars.iv.next76, %.lr.ph66 ], [ 1, %.preheader ]
  %124 = getelementptr inbounds [100010 x i32], ptr @res, i64 0, i64 %indvars.iv75
  %125 = load i32, ptr %124, align 4, !tbaa !5
  %126 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %125)
  %indvars.iv.next76 = add nuw nsw i64 %indvars.iv75, 1
  %127 = load i32, ptr %1, align 4, !tbaa !5
  %128 = sext i32 %127 to i64
  %129 = icmp slt i64 %indvars.iv.next76, %128
  br i1 %129, label %.lr.ph66, label %._crit_edge67, !llvm.loop !14
}

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

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

; Function Attrs: mustprogress 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 #0 align 2

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

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

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

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

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

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


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