; LLVM IR from ncduy0303/Competitive-Programming :: Others/Offline Dynamic Connectivity.ll (Z5solvev)

; 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<std::array<int, 5>, std::allocator<std::array<int, 5>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::array<int, 5>, std::allocator<std::array<int, 5>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::array<int, 5>, std::allocator<std::array<int, 5>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::array<int, 5>, std::allocator<std::array<int, 5>>>::_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::array<int, 2>, std::pair<const std::array<int, 2>, int>, std::_Select1st<std::pair<const std::array<int, 2>, int>>, std::less<std::array<int, 2>>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<std::array<int, 2>, std::pair<const std::array<int, 2>, int>, std::_Select1st<std::pair<const std::array<int, 2>, int>>, std::less<std::array<int, 2>>>::_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.DSU = type { i32, %"class.std::vector.3", %"class.std::vector.3", %"class.std::stack" }
%"class.std::vector.3" = type { %"struct.std::_Vector_base.4" }
%"struct.std::_Vector_base.4" = 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::stack" = type { %"class.std::deque" }
%"class.std::deque" = type { %"class.std::_Deque_base" }
%"class.std::_Deque_base" = type { %"struct.std::_Deque_base<int, std::allocator<int>>::_Deque_impl" }
%"struct.std::_Deque_base<int, std::allocator<int>>::_Deque_impl" = type { %"struct.std::_Deque_base<int, std::allocator<int>>::_Deque_impl_data" }
%"struct.std::_Deque_base<int, std::allocator<int>>::_Deque_impl_data" = type { ptr, i64, %"struct.std::_Deque_iterator", %"struct.std::_Deque_iterator" }
%"struct.std::_Deque_iterator" = type { ptr, ptr, ptr, ptr }
%"class.std::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"struct.std::array" = type { [5 x i32] }
%"class.__gnu_cxx::__normal_iterator" = type { ptr }
%"struct.std::array.8" = type { [2 x i32] }

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@q = external dso_local global i32, align 4
@other = external dso_local global [300001 x i32], align 16
@ans = external dso_local global [300001 x i32], align 16
@qs = external dso_local global %"class.std::vector", align 8
@mp = external dso_local global %"class.std::map", align 8
@uf = external dso_local global %struct.DSU, align 8
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [2 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z3dcoii(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: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(20) ptr @_ZNSt6vectorISt5arrayIiLm5EESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #2 align 2

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

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

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

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

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_Z5solvev() #0 {
  %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::array", align 4
  %7 = alloca %"struct.std::array", align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca %"struct.std::array", align 4
  %13 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %14 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %15 = alloca i32, align 4
  %16 = alloca %"struct.std::array", align 4
  %17 = alloca ptr, align 8
  %18 = alloca ptr, align 8
  %19 = alloca ptr, align 8
  %20 = alloca ptr, align 8
  %21 = alloca ptr, align 8
  %22 = alloca %"struct.std::array.8", align 4
  %23 = alloca %"struct.std::array.8", align 4
  %24 = alloca %"struct.std::array.8", align 4
  %25 = alloca i32, align 4
  %26 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @n)
  %27 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %26, ptr noundef nonnull align 4 dereferenceable(4) @m)
  %28 = load i32, ptr @n, align 4, !tbaa !5
  call void @_ZN3DSU4initEi(ptr noundef nonnull align 8 dereferenceable(136) @uf, i32 noundef %28)
  call void @llvm.lifetime.start.p0(i64 4, ptr %1) #6
  store i32 0, ptr %1, align 4, !tbaa !5
  br label %29

29:                                               ; preds = %56, %0
  %30 = load i32, ptr %1, align 4, !tbaa !5
  %31 = load i32, ptr @m, align 4, !tbaa !5
  %32 = icmp slt i32 %30, %31
  br i1 %32, label %34, label %33

33:                                               ; preds = %29
  call void @llvm.lifetime.end.p0(i64 4, ptr %1) #6
  br label %59

34:                                               ; preds = %29
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  %35 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %36 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %35, ptr noundef nonnull align 4 dereferenceable(4) %3)
  %37 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %36, ptr noundef nonnull align 4 dereferenceable(4) %4)
  %38 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %37, ptr noundef nonnull align 4 dereferenceable(4) %5)
  call void @llvm.lifetime.start.p0(i64 20, ptr %6) #6
  %39 = getelementptr inbounds %"struct.std::array", ptr %6, i32 0, i32 0
  %40 = load i32, ptr %4, align 4, !tbaa !5
  store i32 %40, ptr %39, align 4, !tbaa !5
  %41 = getelementptr inbounds i32, ptr %39, i64 1
  store i32 0, ptr %41, align 4, !tbaa !5
  %42 = getelementptr inbounds i32, ptr %39, i64 2
  store i32 -1, ptr %42, align 4, !tbaa !5
  %43 = getelementptr inbounds i32, ptr %39, i64 3
  %44 = load i32, ptr %2, align 4, !tbaa !5
  store i32 %44, ptr %43, align 4, !tbaa !5
  %45 = getelementptr inbounds i32, ptr %39, i64 4
  %46 = load i32, ptr %3, align 4, !tbaa !5
  store i32 %46, ptr %45, align 4, !tbaa !5
  call void @_ZNSt6vectorISt5arrayIiLm5EESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24) @qs, ptr noundef nonnull align 4 dereferenceable(20) %6)
  call void @llvm.lifetime.end.p0(i64 20, ptr %6) #6
  call void @llvm.lifetime.start.p0(i64 20, ptr %7) #6
  %47 = getelementptr inbounds %"struct.std::array", ptr %7, i32 0, i32 0
  %48 = load i32, ptr %5, align 4, !tbaa !5
  %49 = add nsw i32 %48, 1
  store i32 %49, ptr %47, align 4, !tbaa !5
  %50 = getelementptr inbounds i32, ptr %47, i64 1
  store i32 1, ptr %50, align 4, !tbaa !5
  %51 = getelementptr inbounds i32, ptr %47, i64 2
  store i32 -1, ptr %51, align 4, !tbaa !5
  %52 = getelementptr inbounds i32, ptr %47, i64 3
  %53 = load i32, ptr %2, align 4, !tbaa !5
  store i32 %53, ptr %52, align 4, !tbaa !5
  %54 = getelementptr inbounds i32, ptr %47, i64 4
  %55 = load i32, ptr %3, align 4, !tbaa !5
  store i32 %55, ptr %54, align 4, !tbaa !5
  call void @_ZNSt6vectorISt5arrayIiLm5EESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24) @qs, ptr noundef nonnull align 4 dereferenceable(20) %7)
  call void @llvm.lifetime.end.p0(i64 20, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #6
  br label %56

56:                                               ; preds = %34
  %57 = load i32, ptr %1, align 4, !tbaa !5
  %58 = add nsw i32 %57, 1
  store i32 %58, ptr %1, align 4, !tbaa !5
  br label %29, !llvm.loop !9

59:                                               ; preds = %33
  %60 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @q)
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  store i32 0, ptr %8, align 4, !tbaa !5
  br label %61

61:                                               ; preds = %79, %59
  %62 = load i32, ptr %8, align 4, !tbaa !5
  %63 = load i32, ptr @q, align 4, !tbaa !5
  %64 = icmp slt i32 %62, %63
  br i1 %64, label %66, label %65

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

66:                                               ; preds = %61
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  %67 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %9)
  %68 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %67, ptr noundef nonnull align 4 dereferenceable(4) %10)
  %69 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %68, ptr noundef nonnull align 4 dereferenceable(4) %11)
  call void @llvm.lifetime.start.p0(i64 20, ptr %12) #6
  %70 = getelementptr inbounds %"struct.std::array", ptr %12, i32 0, i32 0
  %71 = load i32, ptr %11, align 4, !tbaa !5
  store i32 %71, ptr %70, align 4, !tbaa !5
  %72 = getelementptr inbounds i32, ptr %70, i64 1
  store i32 2, ptr %72, align 4, !tbaa !5
  %73 = getelementptr inbounds i32, ptr %70, i64 2
  %74 = load i32, ptr %8, align 4, !tbaa !5
  store i32 %74, ptr %73, align 4, !tbaa !5
  %75 = getelementptr inbounds i32, ptr %70, i64 3
  %76 = load i32, ptr %9, align 4, !tbaa !5
  store i32 %76, ptr %75, align 4, !tbaa !5
  %77 = getelementptr inbounds i32, ptr %70, i64 4
  %78 = load i32, ptr %10, align 4, !tbaa !5
  store i32 %78, ptr %77, align 4, !tbaa !5
  call void @_ZNSt6vectorISt5arrayIiLm5EESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24) @qs, ptr noundef nonnull align 4 dereferenceable(20) %12)
  call void @llvm.lifetime.end.p0(i64 20, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  br label %79

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

82:                                               ; preds = %65
  %83 = call ptr @_ZNSt6vectorISt5arrayIiLm5EESaIS1_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) @qs) #6
  %84 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %13, i32 0, i32 0
  store ptr %83, ptr %84, align 8
  %85 = call ptr @_ZNSt6vectorISt5arrayIiLm5EESaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) @qs) #6
  %86 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %14, i32 0, i32 0
  store ptr %85, ptr %86, align 8
  %87 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %13, i32 0, i32 0
  %88 = load ptr, ptr %87, align 8
  %89 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %14, i32 0, i32 0
  %90 = load ptr, ptr %89, align 8
  call void @_ZSt4sortIN9__gnu_cxx17__normal_iteratorIPSt5arrayIiLm5EESt6vectorIS3_SaIS3_EEEEEvT_S9_(ptr %88, ptr %90)
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #6
  store i32 0, ptr %15, align 4, !tbaa !5
  br label %91

91:                                               ; preds = %151, %82
  %92 = load i32, ptr %15, align 4, !tbaa !5
  %93 = sext i32 %92 to i64
  %94 = call noundef i64 @_ZNKSt6vectorISt5arrayIiLm5EESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @qs) #6
  %95 = icmp ult i64 %93, %94
  br i1 %95, label %97, label %96

96:                                               ; preds = %91
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #6
  br label %154

97:                                               ; preds = %91
  call void @llvm.lifetime.start.p0(i64 20, ptr %16) #6
  %98 = load i32, ptr %15, align 4, !tbaa !5
  %99 = sext i32 %98 to i64
  %100 = call noundef nonnull align 4 dereferenceable(20) ptr @_ZNSt6vectorISt5arrayIiLm5EESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @qs, i64 noundef %99) #6
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %16, ptr align 4 %100, i64 20, i1 false), !tbaa.struct !12
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #6
  %101 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3getILm0EiLm5EEOT0_OSt5arrayIS0_XT1_EE(ptr noundef nonnull align 4 dereferenceable(20) %16) #6
  store ptr %101, ptr %17, align 8, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #6
  %102 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3getILm1EiLm5EEOT0_OSt5arrayIS0_XT1_EE(ptr noundef nonnull align 4 dereferenceable(20) %16) #6
  store ptr %102, ptr %18, align 8, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #6
  %103 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3getILm2EiLm5EEOT0_OSt5arrayIS0_XT1_EE(ptr noundef nonnull align 4 dereferenceable(20) %16) #6
  store ptr %103, ptr %19, align 8, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #6
  %104 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3getILm3EiLm5EEOT0_OSt5arrayIS0_XT1_EE(ptr noundef nonnull align 4 dereferenceable(20) %16) #6
  store ptr %104, ptr %20, align 8, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #6
  %105 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3getILm4EiLm5EEOT0_OSt5arrayIS0_XT1_EE(ptr noundef nonnull align 4 dereferenceable(20) %16) #6
  store ptr %105, ptr %21, align 8, !tbaa !14
  %106 = load ptr, ptr %18, align 8, !tbaa !14
  %107 = load i32, ptr %106, align 4, !tbaa !5
  %108 = icmp eq i32 %107, 0
  br i1 %108, label %109, label %123

109:                                              ; preds = %97
  %110 = load i32, ptr %15, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #6
  %111 = getelementptr inbounds %"struct.std::array.8", ptr %22, i32 0, i32 0
  %112 = load ptr, ptr %20, align 8, !tbaa !14
  %113 = load i32, ptr %112, align 4, !tbaa !5
  store i32 %113, ptr %111, align 4, !tbaa !5
  %114 = getelementptr inbounds i32, ptr %111, i64 1
  %115 = load ptr, ptr %21, align 8, !tbaa !14
  %116 = load i32, ptr %115, align 4, !tbaa !5
  store i32 %116, ptr %114, align 4, !tbaa !5
  %117 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapISt5arrayIiLm2EEiSt4lessIS1_ESaISt4pairIKS1_iEEEixEOS1_(ptr noundef nonnull align 8 dereferenceable(48) @mp, ptr noundef nonnull align 4 dereferenceable(8) %22)
  store i32 %110, ptr %117, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #6
  %118 = call noundef i64 @_ZNKSt6vectorISt5arrayIiLm5EESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @qs) #6
  %119 = trunc i64 %118 to i32
  %120 = load i32, ptr %15, align 4, !tbaa !5
  %121 = sext i32 %120 to i64
  %122 = getelementptr inbounds [300001 x i32], ptr @other, i64 0, i64 %121
  store i32 %119, ptr %122, align 4, !tbaa !5
  br label %123

123:                                              ; preds = %109, %97
  %124 = load ptr, ptr %18, align 8, !tbaa !14
  %125 = load i32, ptr %124, align 4, !tbaa !5
  %126 = icmp eq i32 %125, 1
  br i1 %126, label %127, label %150

127:                                              ; preds = %123
  %128 = load i32, ptr %15, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #6
  %129 = getelementptr inbounds %"struct.std::array.8", ptr %23, i32 0, i32 0
  %130 = load ptr, ptr %20, align 8, !tbaa !14
  %131 = load i32, ptr %130, align 4, !tbaa !5
  store i32 %131, ptr %129, align 4, !tbaa !5
  %132 = getelementptr inbounds i32, ptr %129, i64 1
  %133 = load ptr, ptr %21, align 8, !tbaa !14
  %134 = load i32, ptr %133, align 4, !tbaa !5
  store i32 %134, ptr %132, align 4, !tbaa !5
  %135 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapISt5arrayIiLm2EEiSt4lessIS1_ESaISt4pairIKS1_iEEEixEOS1_(ptr noundef nonnull align 8 dereferenceable(48) @mp, ptr noundef nonnull align 4 dereferenceable(8) %23)
  %136 = load i32, ptr %135, align 4, !tbaa !5
  %137 = sext i32 %136 to i64
  %138 = getelementptr inbounds [300001 x i32], ptr @other, i64 0, i64 %137
  store i32 %128, ptr %138, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #6
  %139 = getelementptr inbounds %"struct.std::array.8", ptr %24, i32 0, i32 0
  %140 = load ptr, ptr %20, align 8, !tbaa !14
  %141 = load i32, ptr %140, align 4, !tbaa !5
  store i32 %141, ptr %139, align 4, !tbaa !5
  %142 = getelementptr inbounds i32, ptr %139, i64 1
  %143 = load ptr, ptr %21, align 8, !tbaa !14
  %144 = load i32, ptr %143, align 4, !tbaa !5
  store i32 %144, ptr %142, align 4, !tbaa !5
  %145 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapISt5arrayIiLm2EEiSt4lessIS1_ESaISt4pairIKS1_iEEEixEOS1_(ptr noundef nonnull align 8 dereferenceable(48) @mp, ptr noundef nonnull align 4 dereferenceable(8) %24)
  %146 = load i32, ptr %145, align 4, !tbaa !5
  %147 = load i32, ptr %15, align 4, !tbaa !5
  %148 = sext i32 %147 to i64
  %149 = getelementptr inbounds [300001 x i32], ptr @other, i64 0, i64 %148
  store i32 %146, ptr %149, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #6
  br label %150

150:                                              ; preds = %127, %123
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #6
  call void @llvm.lifetime.end.p0(i64 20, ptr %16) #6
  br label %151

151:                                              ; preds = %150
  %152 = load i32, ptr %15, align 4, !tbaa !5
  %153 = add nsw i32 %152, 1
  store i32 %153, ptr %15, align 4, !tbaa !5
  br label %91, !llvm.loop !16

154:                                              ; preds = %96
  %155 = call noundef i64 @_ZNKSt6vectorISt5arrayIiLm5EESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @qs) #6
  %156 = sub i64 %155, 1
  %157 = trunc i64 %156 to i32
  call void @_Z3dcoii(i32 noundef 0, i32 noundef %157)
  call void @llvm.lifetime.start.p0(i64 4, ptr %25) #6
  store i32 0, ptr %25, align 4, !tbaa !5
  br label %158

158:                                              ; preds = %176, %154
  %159 = load i32, ptr %25, align 4, !tbaa !5
  %160 = load i32, ptr @q, align 4, !tbaa !5
  %161 = icmp slt i32 %159, %160
  br i1 %161, label %163, label %162

162:                                              ; preds = %158
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #6
  br label %179

163:                                              ; preds = %158
  %164 = load i32, ptr %25, align 4, !tbaa !5
  %165 = sext i32 %164 to i64
  %166 = getelementptr inbounds [300001 x i32], ptr @ans, i64 0, i64 %165
  %167 = load i32, ptr %166, align 4, !tbaa !5
  %168 = icmp ne i32 %167, 0
  br i1 %168, label %169, label %170

169:                                              ; preds = %163
  br label %171

170:                                              ; preds = %163
  br label %171

171:                                              ; preds = %170, %169
  %172 = phi ptr [ @.str, %169 ], [ @.str.4, %170 ]
  %173 = getelementptr inbounds [2 x i8], ptr %172, i64 0, i64 0
  %174 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef %173)
  %175 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %174, ptr noundef @.str.5)
  br label %176

176:                                              ; preds = %171
  %177 = load i32, ptr %25, align 4, !tbaa !5
  %178 = add nsw i32 %177, 1
  store i32 %178, ptr %25, align 4, !tbaa !5
  br label %158, !llvm.loop !17

179:                                              ; preds = %162
  ret void
}

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) #4

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3DSU4initEi(ptr noundef nonnull align 8 dereferenceable(136), i32 noundef) #0 align 2

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

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

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

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #5

attributes #0 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 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 = !{i64 0, i64 20, !13}
!13 = !{!7, !7, i64 0}
!14 = !{!15, !15, i64 0}
!15 = !{!"any pointer", !7, i64 0}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !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<std::array<int, 5>, std::allocator<std::array<int, 5>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::array<int, 5>, std::allocator<std::array<int, 5>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::array<int, 5>, std::allocator<std::array<int, 5>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::array<int, 5>, std::allocator<std::array<int, 5>>>::_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::array<int, 2>, std::pair<const std::array<int, 2>, int>, std::_Select1st<std::pair<const std::array<int, 2>, int>>, std::less<std::array<int, 2>>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<std::array<int, 2>, std::pair<const std::array<int, 2>, int>, std::_Select1st<std::pair<const std::array<int, 2>, int>>, std::less<std::array<int, 2>>>::_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.DSU = type { i32, %"class.std::vector.3", %"class.std::vector.3", %"class.std::stack" }
%"class.std::vector.3" = type { %"struct.std::_Vector_base.4" }
%"struct.std::_Vector_base.4" = 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::stack" = type { %"class.std::deque" }
%"class.std::deque" = type { %"class.std::_Deque_base" }
%"class.std::_Deque_base" = type { %"struct.std::_Deque_base<int, std::allocator<int>>::_Deque_impl" }
%"struct.std::_Deque_base<int, std::allocator<int>>::_Deque_impl" = type { %"struct.std::_Deque_base<int, std::allocator<int>>::_Deque_impl_data" }
%"struct.std::_Deque_base<int, std::allocator<int>>::_Deque_impl_data" = type { ptr, i64, %"struct.std::_Deque_iterator", %"struct.std::_Deque_iterator" }
%"struct.std::_Deque_iterator" = type { ptr, ptr, ptr, ptr }
%"class.std::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"struct.std::array" = type { [5 x i32] }
%"struct.std::array.8" = type { [2 x i32] }

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@q = external dso_local global i32, align 4
@other = external dso_local local_unnamed_addr global [300001 x i32], align 16
@ans = external dso_local local_unnamed_addr global [300001 x i32], align 16
@qs = external dso_local global %"class.std::vector", align 8
@mp = external dso_local global %"class.std::map", align 8
@uf = external dso_local global %struct.DSU, align 8
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [2 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z3dcoii(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 nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(20) ptr @_ZNSt6vectorISt5arrayIiLm5EESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #2 align 2

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

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

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

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

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_Z5solvev() local_unnamed_addr #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca %"struct.std::array", align 4
  %6 = alloca %"struct.std::array", align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca %"struct.std::array", align 4
  %11 = alloca %"struct.std::array", align 4
  %12 = alloca %"struct.std::array.8", align 4
  %13 = alloca %"struct.std::array.8", align 4
  %14 = alloca %"struct.std::array.8", align 4
  %15 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @n)
  %16 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %15, ptr noundef nonnull align 4 dereferenceable(4) @m)
  %17 = load i32, ptr @n, align 4, !tbaa !5
  tail call void @_ZN3DSU4initEi(ptr noundef nonnull align 8 dereferenceable(136) @uf, i32 noundef %17)
  %18 = load i32, ptr @m, align 4, !tbaa !5
  %19 = icmp sgt i32 %18, 0
  br i1 %19, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %0
  %20 = getelementptr inbounds i8, ptr %5, i64 4
  %21 = getelementptr inbounds i8, ptr %5, i64 8
  %22 = getelementptr inbounds i8, ptr %5, i64 12
  %23 = getelementptr inbounds i8, ptr %5, i64 16
  %24 = getelementptr inbounds i8, ptr %6, i64 4
  %25 = getelementptr inbounds i8, ptr %6, i64 8
  %26 = getelementptr inbounds i8, ptr %6, i64 12
  %27 = getelementptr inbounds i8, ptr %6, i64 16
  br label %35

._crit_edge:                                      ; preds = %35, %0
  %28 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @q)
  %29 = load i32, ptr @q, align 4, !tbaa !5
  %30 = icmp sgt i32 %29, 0
  br i1 %30, label %.lr.ph30, label %._crit_edge31

.lr.ph30:                                         ; preds = %._crit_edge
  %31 = getelementptr inbounds i8, ptr %10, i64 4
  %32 = getelementptr inbounds i8, ptr %10, i64 8
  %33 = getelementptr inbounds i8, ptr %10, i64 12
  %34 = getelementptr inbounds i8, ptr %10, i64 16
  br label %56

35:                                               ; preds = %.lr.ph, %35
  %.02327 = phi i32 [ 0, %.lr.ph ], [ %47, %35 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #6
  %36 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %1)
  %37 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %36, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %38 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %37, ptr noundef nonnull align 4 dereferenceable(4) %3)
  %39 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %38, ptr noundef nonnull align 4 dereferenceable(4) %4)
  call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %5) #6
  %40 = load i32, ptr %3, align 4, !tbaa !5
  store i32 %40, ptr %5, align 4, !tbaa !5
  store i32 0, ptr %20, align 4, !tbaa !5
  store i32 -1, ptr %21, align 4, !tbaa !5
  %41 = load i32, ptr %1, align 4, !tbaa !5
  store i32 %41, ptr %22, align 4, !tbaa !5
  %42 = load i32, ptr %2, align 4, !tbaa !5
  store i32 %42, ptr %23, align 4, !tbaa !5
  call void @_ZNSt6vectorISt5arrayIiLm5EESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24) @qs, ptr noundef nonnull align 4 dereferenceable(20) %5)
  call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %5) #6
  call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %6) #6
  %43 = load i32, ptr %4, align 4, !tbaa !5
  %44 = add nsw i32 %43, 1
  store i32 %44, ptr %6, align 4, !tbaa !5
  store i32 1, ptr %24, align 4, !tbaa !5
  store i32 -1, ptr %25, align 4, !tbaa !5
  %45 = load i32, ptr %1, align 4, !tbaa !5
  store i32 %45, ptr %26, align 4, !tbaa !5
  %46 = load i32, ptr %2, align 4, !tbaa !5
  store i32 %46, ptr %27, align 4, !tbaa !5
  call void @_ZNSt6vectorISt5arrayIiLm5EESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24) @qs, ptr noundef nonnull align 4 dereferenceable(20) %6)
  call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %6) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #6
  %47 = add nuw nsw i32 %.02327, 1
  %48 = load i32, ptr @m, align 4, !tbaa !5
  %49 = icmp slt i32 %47, %48
  br i1 %49, label %35, label %._crit_edge, !llvm.loop !9

._crit_edge31:                                    ; preds = %56, %._crit_edge
  %50 = call ptr @_ZNSt6vectorISt5arrayIiLm5EESaIS1_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) @qs) #6
  %51 = call ptr @_ZNSt6vectorISt5arrayIiLm5EESaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) @qs) #6
  call void @_ZSt4sortIN9__gnu_cxx17__normal_iteratorIPSt5arrayIiLm5EESt6vectorIS3_SaIS3_EEEEEvT_S9_(ptr %50, ptr %51)
  %52 = call noundef i64 @_ZNKSt6vectorISt5arrayIiLm5EESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @qs) #6
  %.not40 = icmp eq i64 %52, 0
  br i1 %.not40, label %._crit_edge35, label %.lr.ph34

.lr.ph34:                                         ; preds = %._crit_edge31
  %53 = getelementptr inbounds i8, ptr %12, i64 4
  %54 = getelementptr inbounds i8, ptr %13, i64 4
  %55 = getelementptr inbounds i8, ptr %14, i64 4
  br label %71

56:                                               ; preds = %.lr.ph30, %56
  %.02428 = phi i32 [ 0, %.lr.ph30 ], [ %63, %56 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %9) #6
  %57 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %7)
  %58 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %57, ptr noundef nonnull align 4 dereferenceable(4) %8)
  %59 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %58, ptr noundef nonnull align 4 dereferenceable(4) %9)
  call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %10) #6
  %60 = load i32, ptr %9, align 4, !tbaa !5
  store i32 %60, ptr %10, align 4, !tbaa !5
  store i32 2, ptr %31, align 4, !tbaa !5
  store i32 %.02428, ptr %32, align 4, !tbaa !5
  %61 = load i32, ptr %7, align 4, !tbaa !5
  store i32 %61, ptr %33, align 4, !tbaa !5
  %62 = load i32, ptr %8, align 4, !tbaa !5
  store i32 %62, ptr %34, align 4, !tbaa !5
  call void @_ZNSt6vectorISt5arrayIiLm5EESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24) @qs, ptr noundef nonnull align 4 dereferenceable(20) %10)
  call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %10) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %9) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #6
  %63 = add nuw nsw i32 %.02428, 1
  %64 = load i32, ptr @q, align 4, !tbaa !5
  %65 = icmp slt i32 %63, %64
  br i1 %65, label %56, label %._crit_edge31, !llvm.loop !11

._crit_edge35:                                    ; preds = %104, %._crit_edge31
  %66 = call noundef i64 @_ZNKSt6vectorISt5arrayIiLm5EESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @qs) #6
  %67 = trunc i64 %66 to i32
  %68 = add i32 %67, -1
  call void @_Z3dcoii(i32 noundef 0, i32 noundef %68)
  %69 = load i32, ptr @q, align 4, !tbaa !5
  %70 = icmp sgt i32 %69, 0
  br i1 %70, label %.lr.ph38, label %._crit_edge39

71:                                               ; preds = %.lr.ph34, %104
  %indvars.iv = phi i64 [ 0, %.lr.ph34 ], [ %indvars.iv.next, %104 ]
  call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %11) #6
  %72 = call noundef nonnull align 4 dereferenceable(20) ptr @_ZNSt6vectorISt5arrayIiLm5EESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @qs, i64 noundef %indvars.iv) #6
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(20) %11, ptr noundef nonnull align 4 dereferenceable(20) %72, i64 20, i1 false), !tbaa.struct !12
  %73 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3getILm0EiLm5EEOT0_OSt5arrayIS0_XT1_EE(ptr noundef nonnull align 4 dereferenceable(20) %11) #6
  %74 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3getILm1EiLm5EEOT0_OSt5arrayIS0_XT1_EE(ptr noundef nonnull align 4 dereferenceable(20) %11) #6
  %75 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3getILm2EiLm5EEOT0_OSt5arrayIS0_XT1_EE(ptr noundef nonnull align 4 dereferenceable(20) %11) #6
  %76 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3getILm3EiLm5EEOT0_OSt5arrayIS0_XT1_EE(ptr noundef nonnull align 4 dereferenceable(20) %11) #6
  %77 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3getILm4EiLm5EEOT0_OSt5arrayIS0_XT1_EE(ptr noundef nonnull align 4 dereferenceable(20) %11) #6
  %78 = load i32, ptr %74, align 4, !tbaa !5
  %79 = icmp eq i32 %78, 0
  br i1 %79, label %80, label %88

80:                                               ; preds = %71
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %12) #6
  %81 = load i32, ptr %76, align 4, !tbaa !5
  store i32 %81, ptr %12, align 4, !tbaa !5
  %82 = load i32, ptr %77, align 4, !tbaa !5
  store i32 %82, ptr %53, align 4, !tbaa !5
  %83 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapISt5arrayIiLm2EEiSt4lessIS1_ESaISt4pairIKS1_iEEEixEOS1_(ptr noundef nonnull align 8 dereferenceable(48) @mp, ptr noundef nonnull align 4 dereferenceable(8) %12)
  %84 = trunc nuw nsw i64 %indvars.iv to i32
  store i32 %84, ptr %83, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %12) #6
  %85 = call noundef i64 @_ZNKSt6vectorISt5arrayIiLm5EESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @qs) #6
  %86 = trunc i64 %85 to i32
  %87 = getelementptr inbounds [300001 x i32], ptr @other, i64 0, i64 %indvars.iv
  store i32 %86, ptr %87, align 4, !tbaa !5
  %.pr = load i32, ptr %74, align 4, !tbaa !5
  br label %88

88:                                               ; preds = %80, %71
  %89 = phi i32 [ %.pr, %80 ], [ %78, %71 ]
  %90 = icmp eq i32 %89, 1
  br i1 %90, label %91, label %104

91:                                               ; preds = %88
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %13) #6
  %92 = load i32, ptr %76, align 4, !tbaa !5
  store i32 %92, ptr %13, align 4, !tbaa !5
  %93 = load i32, ptr %77, align 4, !tbaa !5
  store i32 %93, ptr %54, align 4, !tbaa !5
  %94 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapISt5arrayIiLm2EEiSt4lessIS1_ESaISt4pairIKS1_iEEEixEOS1_(ptr noundef nonnull align 8 dereferenceable(48) @mp, ptr noundef nonnull align 4 dereferenceable(8) %13)
  %95 = load i32, ptr %94, align 4, !tbaa !5
  %96 = sext i32 %95 to i64
  %97 = getelementptr inbounds [300001 x i32], ptr @other, i64 0, i64 %96
  %98 = trunc nuw nsw i64 %indvars.iv to i32
  store i32 %98, ptr %97, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %13) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %14) #6
  %99 = load i32, ptr %76, align 4, !tbaa !5
  store i32 %99, ptr %14, align 4, !tbaa !5
  %100 = load i32, ptr %77, align 4, !tbaa !5
  store i32 %100, ptr %55, align 4, !tbaa !5
  %101 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapISt5arrayIiLm2EEiSt4lessIS1_ESaISt4pairIKS1_iEEEixEOS1_(ptr noundef nonnull align 8 dereferenceable(48) @mp, ptr noundef nonnull align 4 dereferenceable(8) %14)
  %102 = load i32, ptr %101, align 4, !tbaa !5
  %103 = getelementptr inbounds [300001 x i32], ptr @other, i64 0, i64 %indvars.iv
  store i32 %102, ptr %103, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %14) #6
  br label %104

104:                                              ; preds = %91, %88
  call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %11) #6
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %105 = call noundef i64 @_ZNKSt6vectorISt5arrayIiLm5EESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @qs) #6
  %106 = icmp ugt i64 %105, %indvars.iv.next
  br i1 %106, label %71, label %._crit_edge35, !llvm.loop !14

._crit_edge39:                                    ; preds = %.lr.ph38, %._crit_edge35
  ret void

.lr.ph38:                                         ; preds = %._crit_edge35, %.lr.ph38
  %indvars.iv42 = phi i64 [ %indvars.iv.next43, %.lr.ph38 ], [ 0, %._crit_edge35 ]
  %107 = getelementptr inbounds [300001 x i32], ptr @ans, i64 0, i64 %indvars.iv42
  %108 = load i32, ptr %107, align 4, !tbaa !5
  %.not = icmp eq i32 %108, 0
  %.str..str.4 = select i1 %.not, ptr @.str.4, ptr @.str
  %109 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull %.str..str.4)
  %110 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %109, ptr noundef nonnull @.str.5)
  %indvars.iv.next43 = add nuw nsw i64 %indvars.iv42, 1
  %111 = load i32, ptr @q, align 4, !tbaa !5
  %112 = sext i32 %111 to i64
  %113 = icmp slt i64 %indvars.iv.next43, %112
  br i1 %113, label %.lr.ph38, label %._crit_edge39, !llvm.loop !15
}

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #4

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3DSU4initEi(ptr noundef nonnull align 8 dereferenceable(136), i32 noundef) local_unnamed_addr #0 align 2

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

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

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

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) local_unnamed_addr #5

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


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass