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

; 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 }
%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 }
%"struct.std::array" = type { [5 x i32] }

@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
@uf = external dso_local global %struct.DSU, align 8

; Function Attrs: mustprogress uwtable
define dso_local void @_Z3dcoii(i32 noundef %0, i32 noundef %1) #0 {
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca %"struct.std::array", align 4
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca %"struct.std::array", align 4
  %15 = alloca ptr, align 8
  %16 = alloca ptr, align 8
  %17 = alloca ptr, align 8
  %18 = alloca ptr, align 8
  %19 = alloca ptr, align 8
  %20 = alloca i32, align 4
  %21 = alloca %"struct.std::array", align 4
  %22 = alloca ptr, align 8
  %23 = alloca ptr, align 8
  %24 = alloca ptr, align 8
  %25 = alloca ptr, align 8
  %26 = alloca ptr, align 8
  store i32 %0, ptr %3, align 4, !tbaa !5
  store i32 %1, ptr %4, align 4, !tbaa !5
  %27 = load i32, ptr %3, align 4, !tbaa !5
  %28 = load i32, ptr %4, align 4, !tbaa !5
  %29 = icmp sgt i32 %27, %28
  br i1 %29, label %30, label %31

30:                                               ; preds = %2
  br label %144

31:                                               ; preds = %2
  %32 = load i32, ptr %3, align 4, !tbaa !5
  %33 = load i32, ptr %4, align 4, !tbaa !5
  %34 = icmp eq i32 %32, %33
  br i1 %34, label %35, label %59

35:                                               ; preds = %31
  call void @llvm.lifetime.start.p0(i64 20, ptr %5) #4
  %36 = load i32, ptr %3, align 4, !tbaa !5
  %37 = sext i32 %36 to i64
  %38 = call noundef nonnull align 4 dereferenceable(20) ptr @_ZNSt6vectorISt5arrayIiLm5EESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @qs, i64 noundef %37) #4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %5, ptr align 4 %38, i64 20, i1 false), !tbaa.struct !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #4
  %39 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3getILm0EiLm5EEOT0_OSt5arrayIS0_XT1_EE(ptr noundef nonnull align 4 dereferenceable(20) %5) #4
  store ptr %39, ptr %6, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  %40 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3getILm1EiLm5EEOT0_OSt5arrayIS0_XT1_EE(ptr noundef nonnull align 4 dereferenceable(20) %5) #4
  store ptr %40, ptr %7, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  %41 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3getILm2EiLm5EEOT0_OSt5arrayIS0_XT1_EE(ptr noundef nonnull align 4 dereferenceable(20) %5) #4
  store ptr %41, ptr %8, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  %42 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3getILm3EiLm5EEOT0_OSt5arrayIS0_XT1_EE(ptr noundef nonnull align 4 dereferenceable(20) %5) #4
  store ptr %42, ptr %9, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #4
  %43 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3getILm4EiLm5EEOT0_OSt5arrayIS0_XT1_EE(ptr noundef nonnull align 4 dereferenceable(20) %5) #4
  store ptr %43, ptr %10, align 8, !tbaa !11
  %44 = load ptr, ptr %7, align 8, !tbaa !11
  %45 = load i32, ptr %44, align 4, !tbaa !5
  %46 = icmp eq i32 %45, 2
  br i1 %46, label %47, label %58

47:                                               ; preds = %35
  %48 = load ptr, ptr %9, align 8, !tbaa !11
  %49 = load i32, ptr %48, align 4, !tbaa !5
  %50 = load ptr, ptr %10, align 8, !tbaa !11
  %51 = load i32, ptr %50, align 4, !tbaa !5
  %52 = call noundef zeroext i1 @_ZN3DSU4sameEii(ptr noundef nonnull align 8 dereferenceable(136) @uf, i32 noundef %49, i32 noundef %51)
  %53 = zext i1 %52 to i32
  %54 = load ptr, ptr %8, align 8, !tbaa !11
  %55 = load i32, ptr %54, align 4, !tbaa !5
  %56 = sext i32 %55 to i64
  %57 = getelementptr inbounds [300001 x i32], ptr @ans, i64 0, i64 %56
  store i32 %53, ptr %57, align 4, !tbaa !5
  br label %58

58:                                               ; preds = %47, %35
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 20, ptr %5) #4
  br label %144

59:                                               ; preds = %31
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  %60 = load i32, ptr %3, align 4, !tbaa !5
  %61 = load i32, ptr %4, align 4, !tbaa !5
  %62 = add nsw i32 %60, %61
  %63 = sdiv i32 %62, 2
  store i32 %63, ptr %11, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #4
  %64 = call noundef i64 @_ZNKSt5stackIiSt5dequeIiSaIiEEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(80) getelementptr inbounds (%struct.DSU, ptr @uf, i32 0, i32 3))
  %65 = trunc i64 %64 to i32
  store i32 %65, ptr %12, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #4
  %66 = load i32, ptr %11, align 4, !tbaa !5
  %67 = add nsw i32 %66, 1
  store i32 %67, ptr %13, align 4, !tbaa !5
  br label %68

68:                                               ; preds = %98, %59
  %69 = load i32, ptr %13, align 4, !tbaa !5
  %70 = load i32, ptr %4, align 4, !tbaa !5
  %71 = icmp sle i32 %69, %70
  br i1 %71, label %73, label %72

72:                                               ; preds = %68
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  br label %101

73:                                               ; preds = %68
  call void @llvm.lifetime.start.p0(i64 20, ptr %14) #4
  %74 = load i32, ptr %13, align 4, !tbaa !5
  %75 = sext i32 %74 to i64
  %76 = call noundef nonnull align 4 dereferenceable(20) ptr @_ZNSt6vectorISt5arrayIiLm5EESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @qs, i64 noundef %75) #4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %14, ptr align 4 %76, i64 20, i1 false), !tbaa.struct !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #4
  %77 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3getILm0EiLm5EEOT0_OSt5arrayIS0_XT1_EE(ptr noundef nonnull align 4 dereferenceable(20) %14) #4
  store ptr %77, ptr %15, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #4
  %78 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3getILm1EiLm5EEOT0_OSt5arrayIS0_XT1_EE(ptr noundef nonnull align 4 dereferenceable(20) %14) #4
  store ptr %78, ptr %16, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #4
  %79 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3getILm2EiLm5EEOT0_OSt5arrayIS0_XT1_EE(ptr noundef nonnull align 4 dereferenceable(20) %14) #4
  store ptr %79, ptr %17, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #4
  %80 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3getILm3EiLm5EEOT0_OSt5arrayIS0_XT1_EE(ptr noundef nonnull align 4 dereferenceable(20) %14) #4
  store ptr %80, ptr %18, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #4
  %81 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3getILm4EiLm5EEOT0_OSt5arrayIS0_XT1_EE(ptr noundef nonnull align 4 dereferenceable(20) %14) #4
  store ptr %81, ptr %19, align 8, !tbaa !11
  %82 = load ptr, ptr %16, align 8, !tbaa !11
  %83 = load i32, ptr %82, align 4, !tbaa !5
  %84 = icmp eq i32 %83, 1
  br i1 %84, label %85, label %97

85:                                               ; preds = %73
  %86 = load i32, ptr %13, align 4, !tbaa !5
  %87 = sext i32 %86 to i64
  %88 = getelementptr inbounds [300001 x i32], ptr @other, i64 0, i64 %87
  %89 = load i32, ptr %88, align 4, !tbaa !5
  %90 = load i32, ptr %3, align 4, !tbaa !5
  %91 = icmp slt i32 %89, %90
  br i1 %91, label %92, label %97

92:                                               ; preds = %85
  %93 = load ptr, ptr %18, align 8, !tbaa !11
  %94 = load i32, ptr %93, align 4, !tbaa !5
  %95 = load ptr, ptr %19, align 8, !tbaa !11
  %96 = load i32, ptr %95, align 4, !tbaa !5
  call void @_ZN3DSU5mergeEii(ptr noundef nonnull align 8 dereferenceable(136) @uf, i32 noundef %94, i32 noundef %96)
  br label %97

97:                                               ; preds = %92, %85, %73
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #4
  call void @llvm.lifetime.end.p0(i64 20, ptr %14) #4
  br label %98

98:                                               ; preds = %97
  %99 = load i32, ptr %13, align 4, !tbaa !5
  %100 = add nsw i32 %99, 1
  store i32 %100, ptr %13, align 4, !tbaa !5
  br label %68, !llvm.loop !13

101:                                              ; preds = %72
  %102 = load i32, ptr %3, align 4, !tbaa !5
  %103 = load i32, ptr %11, align 4, !tbaa !5
  call void @_Z3dcoii(i32 noundef %102, i32 noundef %103)
  %104 = load i32, ptr %12, align 4, !tbaa !5
  call void @_ZN3DSU8rollbackEi(ptr noundef nonnull align 8 dereferenceable(136) @uf, i32 noundef %104)
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #4
  %105 = load i32, ptr %3, align 4, !tbaa !5
  store i32 %105, ptr %20, align 4, !tbaa !5
  br label %106

106:                                              ; preds = %136, %101
  %107 = load i32, ptr %20, align 4, !tbaa !5
  %108 = load i32, ptr %11, align 4, !tbaa !5
  %109 = icmp sle i32 %107, %108
  br i1 %109, label %111, label %110

110:                                              ; preds = %106
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #4
  br label %139

111:                                              ; preds = %106
  call void @llvm.lifetime.start.p0(i64 20, ptr %21) #4
  %112 = load i32, ptr %20, align 4, !tbaa !5
  %113 = sext i32 %112 to i64
  %114 = call noundef nonnull align 4 dereferenceable(20) ptr @_ZNSt6vectorISt5arrayIiLm5EESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @qs, i64 noundef %113) #4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %21, ptr align 4 %114, i64 20, i1 false), !tbaa.struct !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #4
  %115 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3getILm0EiLm5EEOT0_OSt5arrayIS0_XT1_EE(ptr noundef nonnull align 4 dereferenceable(20) %21) #4
  store ptr %115, ptr %22, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #4
  %116 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3getILm1EiLm5EEOT0_OSt5arrayIS0_XT1_EE(ptr noundef nonnull align 4 dereferenceable(20) %21) #4
  store ptr %116, ptr %23, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #4
  %117 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3getILm2EiLm5EEOT0_OSt5arrayIS0_XT1_EE(ptr noundef nonnull align 4 dereferenceable(20) %21) #4
  store ptr %117, ptr %24, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %25) #4
  %118 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3getILm3EiLm5EEOT0_OSt5arrayIS0_XT1_EE(ptr noundef nonnull align 4 dereferenceable(20) %21) #4
  store ptr %118, ptr %25, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %26) #4
  %119 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3getILm4EiLm5EEOT0_OSt5arrayIS0_XT1_EE(ptr noundef nonnull align 4 dereferenceable(20) %21) #4
  store ptr %119, ptr %26, align 8, !tbaa !11
  %120 = load ptr, ptr %23, align 8, !tbaa !11
  %121 = load i32, ptr %120, align 4, !tbaa !5
  %122 = icmp eq i32 %121, 0
  br i1 %122, label %123, label %135

123:                                              ; preds = %111
  %124 = load i32, ptr %20, align 4, !tbaa !5
  %125 = sext i32 %124 to i64
  %126 = getelementptr inbounds [300001 x i32], ptr @other, i64 0, i64 %125
  %127 = load i32, ptr %126, align 4, !tbaa !5
  %128 = load i32, ptr %4, align 4, !tbaa !5
  %129 = icmp sgt i32 %127, %128
  br i1 %129, label %130, label %135

130:                                              ; preds = %123
  %131 = load ptr, ptr %25, align 8, !tbaa !11
  %132 = load i32, ptr %131, align 4, !tbaa !5
  %133 = load ptr, ptr %26, align 8, !tbaa !11
  %134 = load i32, ptr %133, align 4, !tbaa !5
  call void @_ZN3DSU5mergeEii(ptr noundef nonnull align 8 dereferenceable(136) @uf, i32 noundef %132, i32 noundef %134)
  br label %135

135:                                              ; preds = %130, %123, %111
  call void @llvm.lifetime.end.p0(i64 8, ptr %26) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #4
  call void @llvm.lifetime.end.p0(i64 20, ptr %21) #4
  br label %136

136:                                              ; preds = %135
  %137 = load i32, ptr %20, align 4, !tbaa !5
  %138 = add nsw i32 %137, 1
  store i32 %138, ptr %20, align 4, !tbaa !5
  br label %106, !llvm.loop !15

139:                                              ; preds = %110
  %140 = load i32, ptr %11, align 4, !tbaa !5
  %141 = add nsw i32 %140, 1
  %142 = load i32, ptr %4, align 4, !tbaa !5
  call void @_Z3dcoii(i32 noundef %141, i32 noundef %142)
  %143 = load i32, ptr %12, align 4, !tbaa !5
  call void @_ZN3DSU8rollbackEi(ptr noundef nonnull align 8 dereferenceable(136) @uf, i32 noundef %143)
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  br label %144

144:                                              ; preds = %139, %58, %30
  ret void
}

; 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: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN3DSU4sameEii(ptr noundef nonnull align 8 dereferenceable(136), i32 noundef, i32 noundef) #0 align 2

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

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

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

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

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 = { 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 = !{i64 0, i64 20, !10}
!10 = !{!7, !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"any pointer", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}


; 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 }
%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 }
%"struct.std::array" = type { [5 x i32] }

@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
@uf = external dso_local global %struct.DSU, align 8

; Function Attrs: mustprogress uwtable
define dso_local void @_Z3dcoii(i32 noundef %0, i32 noundef %1) local_unnamed_addr #0 {
  %3 = alloca %"struct.std::array", align 4
  %4 = alloca %"struct.std::array", align 4
  %5 = alloca %"struct.std::array", align 4
  %6 = icmp sgt i32 %0, %1
  br i1 %6, label %69, label %7

7:                                                ; preds = %2
  %8 = icmp eq i32 %0, %1
  br i1 %8, label %9, label %28

9:                                                ; preds = %7
  call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %3) #4
  %10 = sext i32 %0 to i64
  %11 = tail call noundef nonnull align 4 dereferenceable(20) ptr @_ZNSt6vectorISt5arrayIiLm5EESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @qs, i64 noundef %10) #4
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(20) %3, ptr noundef nonnull align 4 dereferenceable(20) %11, i64 20, i1 false), !tbaa.struct !5
  %12 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3getILm0EiLm5EEOT0_OSt5arrayIS0_XT1_EE(ptr noundef nonnull align 4 dereferenceable(20) %3) #4
  %13 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3getILm1EiLm5EEOT0_OSt5arrayIS0_XT1_EE(ptr noundef nonnull align 4 dereferenceable(20) %3) #4
  %14 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3getILm2EiLm5EEOT0_OSt5arrayIS0_XT1_EE(ptr noundef nonnull align 4 dereferenceable(20) %3) #4
  %15 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3getILm3EiLm5EEOT0_OSt5arrayIS0_XT1_EE(ptr noundef nonnull align 4 dereferenceable(20) %3) #4
  %16 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3getILm4EiLm5EEOT0_OSt5arrayIS0_XT1_EE(ptr noundef nonnull align 4 dereferenceable(20) %3) #4
  %17 = load i32, ptr %13, align 4, !tbaa !9
  %18 = icmp eq i32 %17, 2
  br i1 %18, label %19, label %27

19:                                               ; preds = %9
  %20 = load i32, ptr %15, align 4, !tbaa !9
  %21 = load i32, ptr %16, align 4, !tbaa !9
  %22 = call noundef zeroext i1 @_ZN3DSU4sameEii(ptr noundef nonnull align 8 dereferenceable(136) @uf, i32 noundef %20, i32 noundef %21)
  %23 = zext i1 %22 to i32
  %24 = load i32, ptr %14, align 4, !tbaa !9
  %25 = sext i32 %24 to i64
  %26 = getelementptr inbounds [300001 x i32], ptr @ans, i64 0, i64 %25
  store i32 %23, ptr %26, align 4, !tbaa !9
  br label %27

27:                                               ; preds = %19, %9
  call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %3) #4
  br label %69

28:                                               ; preds = %7
  %29 = add nsw i32 %1, %0
  %30 = sdiv i32 %29, 2
  %31 = tail call noundef i64 @_ZNKSt5stackIiSt5dequeIiSaIiEEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(80) getelementptr inbounds (i8, ptr @uf, i64 56))
  %32 = trunc i64 %31 to i32
  %33 = add nsw i32 %30, 1
  %.not40.not = icmp slt i32 %30, %1
  br i1 %.not40.not, label %.lr.ph.preheader, label %._crit_edge

.lr.ph.preheader:                                 ; preds = %28
  %narrow = add nsw i32 %30, 1
  %34 = sext i32 %narrow to i64
  %35 = add i32 %1, 1
  br label %.lr.ph

._crit_edge:                                      ; preds = %52, %28
  call void @_Z3dcoii(i32 noundef %0, i32 noundef %30)
  call void @_ZN3DSU8rollbackEi(ptr noundef nonnull align 8 dereferenceable(136) @uf, i32 noundef %32)
  %.not3942 = icmp slt i32 %30, %0
  br i1 %.not3942, label %._crit_edge46, label %.lr.ph45.preheader

.lr.ph45.preheader:                               ; preds = %._crit_edge
  %36 = sext i32 %0 to i64
  br label %.lr.ph45

.lr.ph:                                           ; preds = %.lr.ph.preheader, %52
  %indvars.iv = phi i64 [ %34, %.lr.ph.preheader ], [ %indvars.iv.next, %52 ]
  call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %4) #4
  %37 = call noundef nonnull align 4 dereferenceable(20) ptr @_ZNSt6vectorISt5arrayIiLm5EESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @qs, i64 noundef %indvars.iv) #4
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(20) %4, ptr noundef nonnull align 4 dereferenceable(20) %37, i64 20, i1 false), !tbaa.struct !5
  %38 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3getILm0EiLm5EEOT0_OSt5arrayIS0_XT1_EE(ptr noundef nonnull align 4 dereferenceable(20) %4) #4
  %39 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3getILm1EiLm5EEOT0_OSt5arrayIS0_XT1_EE(ptr noundef nonnull align 4 dereferenceable(20) %4) #4
  %40 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3getILm2EiLm5EEOT0_OSt5arrayIS0_XT1_EE(ptr noundef nonnull align 4 dereferenceable(20) %4) #4
  %41 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3getILm3EiLm5EEOT0_OSt5arrayIS0_XT1_EE(ptr noundef nonnull align 4 dereferenceable(20) %4) #4
  %42 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3getILm4EiLm5EEOT0_OSt5arrayIS0_XT1_EE(ptr noundef nonnull align 4 dereferenceable(20) %4) #4
  %43 = load i32, ptr %39, align 4, !tbaa !9
  %44 = icmp eq i32 %43, 1
  br i1 %44, label %45, label %52

45:                                               ; preds = %.lr.ph
  %46 = getelementptr inbounds [300001 x i32], ptr @other, i64 0, i64 %indvars.iv
  %47 = load i32, ptr %46, align 4, !tbaa !9
  %48 = icmp slt i32 %47, %0
  br i1 %48, label %49, label %52

49:                                               ; preds = %45
  %50 = load i32, ptr %41, align 4, !tbaa !9
  %51 = load i32, ptr %42, align 4, !tbaa !9
  call void @_ZN3DSU5mergeEii(ptr noundef nonnull align 8 dereferenceable(136) @uf, i32 noundef %50, i32 noundef %51)
  br label %52

52:                                               ; preds = %49, %45, %.lr.ph
  call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %4) #4
  %indvars.iv.next = add nsw i64 %indvars.iv, 1
  %lftr.wideiv = trunc i64 %indvars.iv.next to i32
  %exitcond.not = icmp eq i32 %35, %lftr.wideiv
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph, !llvm.loop !11

._crit_edge46:                                    ; preds = %68, %._crit_edge
  call void @_Z3dcoii(i32 noundef %33, i32 noundef %1)
  call void @_ZN3DSU8rollbackEi(ptr noundef nonnull align 8 dereferenceable(136) @uf, i32 noundef %32)
  br label %69

.lr.ph45:                                         ; preds = %.lr.ph45.preheader, %68
  %indvars.iv48 = phi i64 [ %36, %.lr.ph45.preheader ], [ %indvars.iv.next49, %68 ]
  call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %5) #4
  %53 = call noundef nonnull align 4 dereferenceable(20) ptr @_ZNSt6vectorISt5arrayIiLm5EESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @qs, i64 noundef %indvars.iv48) #4
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(20) %5, ptr noundef nonnull align 4 dereferenceable(20) %53, i64 20, i1 false), !tbaa.struct !5
  %54 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3getILm0EiLm5EEOT0_OSt5arrayIS0_XT1_EE(ptr noundef nonnull align 4 dereferenceable(20) %5) #4
  %55 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3getILm1EiLm5EEOT0_OSt5arrayIS0_XT1_EE(ptr noundef nonnull align 4 dereferenceable(20) %5) #4
  %56 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3getILm2EiLm5EEOT0_OSt5arrayIS0_XT1_EE(ptr noundef nonnull align 4 dereferenceable(20) %5) #4
  %57 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3getILm3EiLm5EEOT0_OSt5arrayIS0_XT1_EE(ptr noundef nonnull align 4 dereferenceable(20) %5) #4
  %58 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3getILm4EiLm5EEOT0_OSt5arrayIS0_XT1_EE(ptr noundef nonnull align 4 dereferenceable(20) %5) #4
  %59 = load i32, ptr %55, align 4, !tbaa !9
  %60 = icmp eq i32 %59, 0
  br i1 %60, label %61, label %68

61:                                               ; preds = %.lr.ph45
  %62 = getelementptr inbounds [300001 x i32], ptr @other, i64 0, i64 %indvars.iv48
  %63 = load i32, ptr %62, align 4, !tbaa !9
  %64 = icmp sgt i32 %63, %1
  br i1 %64, label %65, label %68

65:                                               ; preds = %61
  %66 = load i32, ptr %57, align 4, !tbaa !9
  %67 = load i32, ptr %58, align 4, !tbaa !9
  call void @_ZN3DSU5mergeEii(ptr noundef nonnull align 8 dereferenceable(136) @uf, i32 noundef %66, i32 noundef %67)
  br label %68

68:                                               ; preds = %65, %61, %.lr.ph45
  call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %5) #4
  %indvars.iv.next49 = add nsw i64 %indvars.iv48, 1
  %lftr.wideiv51 = trunc i64 %indvars.iv.next49 to i32
  %exitcond52.not = icmp eq i32 %33, %lftr.wideiv51
  br i1 %exitcond52.not, label %._crit_edge46, label %.lr.ph45, !llvm.loop !13

69:                                               ; preds = %2, %._crit_edge46, %27
  ret void
}

; 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 uwtable
declare dso_local noundef zeroext i1 @_ZN3DSU4sameEii(ptr noundef nonnull align 8 dereferenceable(136), i32 noundef, i32 noundef) local_unnamed_addr #0 align 2

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

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

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

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

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 = { 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 = !{i64 0, i64 20, !6}
!6 = !{!7, !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}


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