; LLVM IR from MtSaka/library :: test/yosupo/data_structure/unionfind_with_potential_non_commutative_group.test (main)

; 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"

%"struct.fastio::Scanner" = type <{ i32, [131073 x i8], [3 x i8], i32, i32, i8, [3 x i8] }>
%struct.WeightedUnionFind = type { %"class.std::vector", %"class.std::vector.1" }
%"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::vector.1" = type { %"struct.std::_Vector_base.2" }
%"struct.std::_Vector_base.2" = type { %"struct.std::_Vector_base<Matrix<StaticModInt<unsigned int, 998244353>>, std::allocator<Matrix<StaticModInt<unsigned int, 998244353>>>>::_Vector_impl" }
%"struct.std::_Vector_base<Matrix<StaticModInt<unsigned int, 998244353>>, std::allocator<Matrix<StaticModInt<unsigned int, 998244353>>>>::_Vector_impl" = type { %"struct.std::_Vector_base<Matrix<StaticModInt<unsigned int, 998244353>>, std::allocator<Matrix<StaticModInt<unsigned int, 998244353>>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<Matrix<StaticModInt<unsigned int, 998244353>>, std::allocator<Matrix<StaticModInt<unsigned int, 998244353>>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%struct.Matrix = type { %"class.std::vector.6" }
%"class.std::vector.6" = type { %"struct.std::_Vector_base.7" }
%"struct.std::_Vector_base.7" = type { %"struct.std::_Vector_base<std::vector<StaticModInt<unsigned int, 998244353>>, std::allocator<std::vector<StaticModInt<unsigned int, 998244353>>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::vector<StaticModInt<unsigned int, 998244353>>, std::allocator<std::vector<StaticModInt<unsigned int, 998244353>>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::vector<StaticModInt<unsigned int, 998244353>>, std::allocator<std::vector<StaticModInt<unsigned int, 998244353>>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::vector<StaticModInt<unsigned int, 998244353>>, std::allocator<std::vector<StaticModInt<unsigned int, 998244353>>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"struct.std::pair" = type { i8, i8 }

@_ZN6fastio2scE = external dso_local global %"struct.fastio::Scanner", align 4

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 personality ptr @__gxx_personality_v0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca %struct.WeightedUnionFind, align 8
  %5 = alloca i64, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca %struct.Matrix, align 8
  %12 = alloca %"struct.std::pair", align 1
  %13 = alloca %struct.Matrix, align 8
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca %struct.Matrix, align 8
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #6
  call void @_Z4scanIiJiEEvRT_DpRT0_(ptr noundef nonnull align 4 dereferenceable(4) %2, ptr noundef nonnull align 4 dereferenceable(4) %3)
  call void @llvm.lifetime.start.p0(i64 48, ptr %4) #6
  %18 = load i32, ptr %2, align 4, !tbaa !5
  call void @_ZN17WeightedUnionFindI4ProdLb1EEC2Ei(ptr noundef nonnull align 8 dereferenceable(48) %4, i32 noundef %18)
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #6
  store i64 0, ptr %5, align 8, !tbaa !9
  br label %19

19:                                               ; preds = %105, %0
  %20 = load i64, ptr %5, align 8, !tbaa !9
  %21 = load i32, ptr %3, align 4, !tbaa !5
  %22 = sext i32 %21 to i64
  %23 = icmp slt i64 %20, %22
  br i1 %23, label %25, label %24

24:                                               ; preds = %19
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #6
  br label %109

25:                                               ; preds = %19
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  invoke void @_Z4scanIiJiiEEvRT_DpRT0_(ptr noundef nonnull align 4 dereferenceable(4) %6, ptr noundef nonnull align 4 dereferenceable(4) %7, ptr noundef nonnull align 4 dereferenceable(4) %8)
          to label %26 unwind label %44

26:                                               ; preds = %25
  %27 = load i32, ptr %6, align 4, !tbaa !5
  %28 = icmp eq i32 %27, 0
  br i1 %28, label %29, label %78

29:                                               ; preds = %26
  call void @llvm.lifetime.start.p0(i64 24, ptr %11) #6
  invoke void @_ZN6MatrixI12StaticModIntIjLj998244353EEEC2Eii(ptr noundef nonnull align 8 dereferenceable(24) %11, i32 noundef 2, i32 noundef 2)
          to label %30 unwind label %48

30:                                               ; preds = %29
  %31 = invoke noundef nonnull align 4 dereferenceable(131089) ptr @_ZN6fastio7ScannerILm131072ELi16EErsI6MatrixI12StaticModIntIjLj998244353EEEEERS1_RT_(ptr noundef nonnull align 4 dereferenceable(131089) @_ZN6fastio2scE, ptr noundef nonnull align 8 dereferenceable(24) %11)
          to label %32 unwind label %52

32:                                               ; preds = %30
  call void @llvm.lifetime.start.p0(i64 2, ptr %12) #6
  %33 = load i32, ptr %7, align 4, !tbaa !5
  %34 = load i32, ptr %8, align 4, !tbaa !5
  invoke void @_ZN6MatrixI12StaticModIntIjLj998244353EEEC2ERKS2_(ptr noundef nonnull align 8 dereferenceable(24) %13, ptr noundef nonnull align 8 dereferenceable(24) %11)
          to label %35 unwind label %56

35:                                               ; preds = %32
  %36 = invoke i16 @_ZN17WeightedUnionFindI4ProdLb1EE5mergeEii6MatrixI12StaticModIntIjLj998244353EEE(ptr noundef nonnull align 8 dereferenceable(48) %4, i32 noundef %33, i32 noundef %34, ptr noundef %13)
          to label %37 unwind label %60

37:                                               ; preds = %35
  store i16 %36, ptr %12, align 1
  %38 = getelementptr inbounds %"struct.std::pair", ptr %12, i32 0, i32 1
  %39 = load i8, ptr %38, align 1, !tbaa !11, !range !14, !noundef !15
  %40 = trunc i8 %39 to i1
  %41 = xor i1 %40, true
  call void @_ZNSt6vectorIS_I12StaticModIntIjLj998244353EESaIS1_EESaIS3_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %13) #6
  call void @llvm.lifetime.end.p0(i64 2, ptr %12) #6
  br i1 %41, label %42, label %69

42:                                               ; preds = %37
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #6
  store i32 0, ptr %14, align 4, !tbaa !5
  invoke void @_Z5printIiEvRKT_(ptr noundef nonnull align 4 dereferenceable(4) %14)
          to label %43 unwind label %65

43:                                               ; preds = %42
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #6
  br label %75

44:                                               ; preds = %78, %25
  %45 = landingpad { ptr, i32 }
          cleanup
  %46 = extractvalue { ptr, i32 } %45, 0
  store ptr %46, ptr %9, align 8
  %47 = extractvalue { ptr, i32 } %45, 1
  store i32 %47, ptr %10, align 4
  br label %108

48:                                               ; preds = %29
  %49 = landingpad { ptr, i32 }
          cleanup
  %50 = extractvalue { ptr, i32 } %49, 0
  store ptr %50, ptr %9, align 8
  %51 = extractvalue { ptr, i32 } %49, 1
  store i32 %51, ptr %10, align 4
  br label %77

52:                                               ; preds = %30
  %53 = landingpad { ptr, i32 }
          cleanup
  %54 = extractvalue { ptr, i32 } %53, 0
  store ptr %54, ptr %9, align 8
  %55 = extractvalue { ptr, i32 } %53, 1
  store i32 %55, ptr %10, align 4
  br label %76

56:                                               ; preds = %32
  %57 = landingpad { ptr, i32 }
          cleanup
  %58 = extractvalue { ptr, i32 } %57, 0
  store ptr %58, ptr %9, align 8
  %59 = extractvalue { ptr, i32 } %57, 1
  store i32 %59, ptr %10, align 4
  br label %64

60:                                               ; preds = %35
  %61 = landingpad { ptr, i32 }
          cleanup
  %62 = extractvalue { ptr, i32 } %61, 0
  store ptr %62, ptr %9, align 8
  %63 = extractvalue { ptr, i32 } %61, 1
  store i32 %63, ptr %10, align 4
  call void @_ZNSt6vectorIS_I12StaticModIntIjLj998244353EESaIS1_EESaIS3_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %13) #6
  br label %64

64:                                               ; preds = %60, %56
  call void @llvm.lifetime.end.p0(i64 2, ptr %12) #6
  br label %76

65:                                               ; preds = %42
  %66 = landingpad { ptr, i32 }
          cleanup
  %67 = extractvalue { ptr, i32 } %66, 0
  store ptr %67, ptr %9, align 8
  %68 = extractvalue { ptr, i32 } %66, 1
  store i32 %68, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #6
  br label %76

69:                                               ; preds = %37
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #6
  store i32 1, ptr %15, align 4, !tbaa !5
  invoke void @_Z5printIiEvRKT_(ptr noundef nonnull align 4 dereferenceable(4) %15)
          to label %70 unwind label %71

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

71:                                               ; preds = %69
  %72 = landingpad { ptr, i32 }
          cleanup
  %73 = extractvalue { ptr, i32 } %72, 0
  store ptr %73, ptr %9, align 8
  %74 = extractvalue { ptr, i32 } %72, 1
  store i32 %74, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #6
  br label %76

75:                                               ; preds = %70, %43
  call void @_ZNSt6vectorIS_I12StaticModIntIjLj998244353EESaIS1_EESaIS3_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %11) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr %11) #6
  br label %104

76:                                               ; preds = %71, %65, %64, %52
  call void @_ZNSt6vectorIS_I12StaticModIntIjLj998244353EESaIS1_EESaIS3_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %11) #6
  br label %77

77:                                               ; preds = %76, %48
  call void @llvm.lifetime.end.p0(i64 24, ptr %11) #6
  br label %108

78:                                               ; preds = %26
  %79 = load i32, ptr %7, align 4, !tbaa !5
  %80 = load i32, ptr %8, align 4, !tbaa !5
  %81 = invoke noundef zeroext i1 @_ZN17WeightedUnionFindI4ProdLb1EE4sameEii(ptr noundef nonnull align 8 dereferenceable(48) %4, i32 noundef %79, i32 noundef %80)
          to label %82 unwind label %44

82:                                               ; preds = %78
  br i1 %81, label %89, label %83

83:                                               ; preds = %82
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #6
  store i32 -1, ptr %16, align 4, !tbaa !5
  invoke void @_Z5printIiEvRKT_(ptr noundef nonnull align 4 dereferenceable(4) %16)
          to label %84 unwind label %85

84:                                               ; preds = %83
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #6
  br label %103

85:                                               ; preds = %83
  %86 = landingpad { ptr, i32 }
          cleanup
  %87 = extractvalue { ptr, i32 } %86, 0
  store ptr %87, ptr %9, align 8
  %88 = extractvalue { ptr, i32 } %86, 1
  store i32 %88, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #6
  br label %108

89:                                               ; preds = %82
  call void @llvm.lifetime.start.p0(i64 24, ptr %17) #6
  %90 = load i32, ptr %7, align 4, !tbaa !5
  %91 = load i32, ptr %8, align 4, !tbaa !5
  invoke void @_ZN17WeightedUnionFindI4ProdLb1EE4diffEii(ptr dead_on_unwind writable sret(%struct.Matrix) align 8 %17, ptr noundef nonnull align 8 dereferenceable(48) %4, i32 noundef %90, i32 noundef %91)
          to label %92 unwind label %94

92:                                               ; preds = %89
  invoke void @_Z5printI6MatrixI12StaticModIntIjLj998244353EEEEvRKT_(ptr noundef nonnull align 8 dereferenceable(24) %17)
          to label %93 unwind label %98

93:                                               ; preds = %92
  call void @_ZNSt6vectorIS_I12StaticModIntIjLj998244353EESaIS1_EESaIS3_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %17) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr %17) #6
  br label %103

94:                                               ; preds = %89
  %95 = landingpad { ptr, i32 }
          cleanup
  %96 = extractvalue { ptr, i32 } %95, 0
  store ptr %96, ptr %9, align 8
  %97 = extractvalue { ptr, i32 } %95, 1
  store i32 %97, ptr %10, align 4
  br label %102

98:                                               ; preds = %92
  %99 = landingpad { ptr, i32 }
          cleanup
  %100 = extractvalue { ptr, i32 } %99, 0
  store ptr %100, ptr %9, align 8
  %101 = extractvalue { ptr, i32 } %99, 1
  store i32 %101, ptr %10, align 4
  call void @_ZNSt6vectorIS_I12StaticModIntIjLj998244353EESaIS1_EESaIS3_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %17) #6
  br label %102

102:                                              ; preds = %98, %94
  call void @llvm.lifetime.end.p0(i64 24, ptr %17) #6
  br label %108

103:                                              ; preds = %93, %84
  br label %104

104:                                              ; preds = %103, %75
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  br label %105

105:                                              ; preds = %104
  %106 = load i64, ptr %5, align 8, !tbaa !9
  %107 = add nsw i64 %106, 1
  store i64 %107, ptr %5, align 8, !tbaa !9
  br label %19, !llvm.loop !16

108:                                              ; preds = %102, %85, %77, %44
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #6
  call void @_ZN17WeightedUnionFindI4ProdLb1EED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %4) #6
  call void @llvm.lifetime.end.p0(i64 48, 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 %111

109:                                              ; preds = %24
  call void @_ZN17WeightedUnionFindI4ProdLb1EED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %4) #6
  call void @llvm.lifetime.end.p0(i64 48, 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
  %110 = load i32, ptr %1, align 4
  ret i32 %110

111:                                              ; preds = %108
  %112 = load ptr, ptr %9, align 8
  %113 = load i32, ptr %10, align 4
  %114 = insertvalue { ptr, i32 } poison, ptr %112, 0
  %115 = insertvalue { ptr, i32 } %114, i32 %113, 1
  resume { ptr, i32 } %115
}

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_Z4scanIiJiEEvRT_DpRT0_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN17WeightedUnionFindI4ProdLb1EEC2Ei(ptr noundef nonnull align 8 dereferenceable(48), i32 noundef) unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_Z4scanIiJiiEEvRT_DpRT0_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6MatrixI12StaticModIntIjLj998244353EEEC2Eii(ptr noundef nonnull align 8 dereferenceable(24), i32 noundef, i32 noundef) unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 4 dereferenceable(131089) ptr @_ZN6fastio7ScannerILm131072ELi16EErsI6MatrixI12StaticModIntIjLj998244353EEEEERS1_RT_(ptr noundef nonnull align 4 dereferenceable(131089), ptr noundef nonnull align 8 dereferenceable(24)) #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local i16 @_ZN17WeightedUnionFindI4ProdLb1EE5mergeEii6MatrixI12StaticModIntIjLj998244353EEE(ptr noundef nonnull align 8 dereferenceable(48), i32 noundef, i32 noundef, ptr noundef) #3 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN6MatrixI12StaticModIntIjLj998244353EEEC2ERKS2_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #2 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: inlinehint mustprogress uwtable
declare dso_local void @_Z5printIiEvRKT_(ptr noundef nonnull align 4 dereferenceable(4)) #2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN17WeightedUnionFindI4ProdLb1EE4sameEii(ptr noundef nonnull align 8 dereferenceable(48), i32 noundef, i32 noundef) #3 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN17WeightedUnionFindI4ProdLb1EE4diffEii(ptr dead_on_unwind noalias writable sret(%struct.Matrix) align 8, ptr noundef nonnull align 8 dereferenceable(48), i32 noundef, i32 noundef) #3 align 2

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

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

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { 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 #4 = { 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 #5 = { 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 = !{!10, !10, i64 0}
!10 = !{!"long long", !7, i64 0}
!11 = !{!12, !13, i64 1}
!12 = !{!"_ZTSSt4pairIbbE", !13, i64 0, !13, i64 1}
!13 = !{!"bool", !7, i64 0}
!14 = !{i8 0, i8 2}
!15 = !{}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}


; 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"

%"struct.fastio::Scanner" = type <{ i32, [131073 x i8], [3 x i8], i32, i32, i8, [3 x i8] }>
%struct.WeightedUnionFind = type { %"class.std::vector", %"class.std::vector.1" }
%"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::vector.1" = type { %"struct.std::_Vector_base.2" }
%"struct.std::_Vector_base.2" = type { %"struct.std::_Vector_base<Matrix<StaticModInt<unsigned int, 998244353>>, std::allocator<Matrix<StaticModInt<unsigned int, 998244353>>>>::_Vector_impl" }
%"struct.std::_Vector_base<Matrix<StaticModInt<unsigned int, 998244353>>, std::allocator<Matrix<StaticModInt<unsigned int, 998244353>>>>::_Vector_impl" = type { %"struct.std::_Vector_base<Matrix<StaticModInt<unsigned int, 998244353>>, std::allocator<Matrix<StaticModInt<unsigned int, 998244353>>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<Matrix<StaticModInt<unsigned int, 998244353>>, std::allocator<Matrix<StaticModInt<unsigned int, 998244353>>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%struct.Matrix = type { %"class.std::vector.6" }
%"class.std::vector.6" = type { %"struct.std::_Vector_base.7" }
%"struct.std::_Vector_base.7" = type { %"struct.std::_Vector_base<std::vector<StaticModInt<unsigned int, 998244353>>, std::allocator<std::vector<StaticModInt<unsigned int, 998244353>>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::vector<StaticModInt<unsigned int, 998244353>>, std::allocator<std::vector<StaticModInt<unsigned int, 998244353>>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::vector<StaticModInt<unsigned int, 998244353>>, std::allocator<std::vector<StaticModInt<unsigned int, 998244353>>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::vector<StaticModInt<unsigned int, 998244353>>, std::allocator<std::vector<StaticModInt<unsigned int, 998244353>>>>::_Vector_impl_data" = type { ptr, ptr, ptr }

@_ZN6fastio2scE = external dso_local global %"struct.fastio::Scanner", align 4

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca %struct.WeightedUnionFind, align 8
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca %struct.Matrix, align 8
  %8 = alloca %struct.Matrix, align 8
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca %struct.Matrix, align 8
  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 @_Z4scanIiJiEEvRT_DpRT0_(ptr noundef nonnull align 4 dereferenceable(4) %1, ptr noundef nonnull align 4 dereferenceable(4) %2)
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %3) #6
  %13 = load i32, ptr %1, align 4, !tbaa !5
  call void @_ZN17WeightedUnionFindI4ProdLb1EEC2Ei(ptr noundef nonnull align 8 dereferenceable(48) %3, i32 noundef %13)
  %14 = load i32, ptr %2, align 4, !tbaa !5
  %15 = icmp sgt i32 %14, 0
  br i1 %15, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %69, %0
  call void @_ZN17WeightedUnionFindI4ProdLb1EED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %3) #6
  call void @llvm.lifetime.end.p0(i64 48, 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
  ret i32 0

.lr.ph:                                           ; preds = %0, %69
  %.017 = phi i64 [ %70, %69 ], [ 0, %0 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #6
  invoke void @_Z4scanIiJiiEEvRT_DpRT0_(ptr noundef nonnull align 4 dereferenceable(4) %4, ptr noundef nonnull align 4 dereferenceable(4) %5, ptr noundef nonnull align 4 dereferenceable(4) %6)
          to label %16 unwind label %31

16:                                               ; preds = %.lr.ph
  %17 = load i32, ptr %4, align 4, !tbaa !5
  %18 = icmp eq i32 %17, 0
  br i1 %18, label %19, label %50

19:                                               ; preds = %16
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %7) #6
  invoke void @_ZN6MatrixI12StaticModIntIjLj998244353EEEC2Eii(ptr noundef nonnull align 8 dereferenceable(24) %7, i32 noundef 2, i32 noundef 2)
          to label %20 unwind label %33

20:                                               ; preds = %19
  %21 = invoke noundef nonnull align 4 dereferenceable(131089) ptr @_ZN6fastio7ScannerILm131072ELi16EErsI6MatrixI12StaticModIntIjLj998244353EEEEERS1_RT_(ptr noundef nonnull align 4 dereferenceable(131089) @_ZN6fastio2scE, ptr noundef nonnull align 8 dereferenceable(24) %7)
          to label %22 unwind label %35

22:                                               ; preds = %20
  %23 = load i32, ptr %5, align 4, !tbaa !5
  %24 = load i32, ptr %6, align 4, !tbaa !5
  invoke void @_ZN6MatrixI12StaticModIntIjLj998244353EEEC2ERKS2_(ptr noundef nonnull align 8 dereferenceable(24) %8, ptr noundef nonnull align 8 dereferenceable(24) %7)
          to label %25 unwind label %37

25:                                               ; preds = %22
  %26 = invoke i16 @_ZN17WeightedUnionFindI4ProdLb1EE5mergeEii6MatrixI12StaticModIntIjLj998244353EEE(ptr noundef nonnull align 8 dereferenceable(48) %3, i32 noundef %23, i32 noundef %24, ptr noundef nonnull %8)
          to label %27 unwind label %39

27:                                               ; preds = %25
  %28 = and i16 %26, 256
  %.not = icmp eq i16 %28, 0
  call void @_ZNSt6vectorIS_I12StaticModIntIjLj998244353EESaIS1_EESaIS3_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %8) #6
  br i1 %.not, label %29, label %43

29:                                               ; preds = %27
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %9) #6
  store i32 0, ptr %9, align 4, !tbaa !5
  invoke void @_Z5printIiEvRKT_(ptr noundef nonnull align 4 dereferenceable(4) %9)
          to label %30 unwind label %41

30:                                               ; preds = %29
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %9) #6
  br label %47

31:                                               ; preds = %50, %.lr.ph
  %32 = landingpad { ptr, i32 }
          cleanup
  br label %74

33:                                               ; preds = %19
  %34 = landingpad { ptr, i32 }
          cleanup
  br label %49

35:                                               ; preds = %20
  %36 = landingpad { ptr, i32 }
          cleanup
  br label %48

37:                                               ; preds = %22
  %38 = landingpad { ptr, i32 }
          cleanup
  br label %48

39:                                               ; preds = %25
  %40 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt6vectorIS_I12StaticModIntIjLj998244353EESaIS1_EESaIS3_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %8) #6
  br label %48

41:                                               ; preds = %29
  %42 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %9) #6
  br label %48

43:                                               ; preds = %27
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %10) #6
  store i32 1, ptr %10, align 4, !tbaa !5
  invoke void @_Z5printIiEvRKT_(ptr noundef nonnull align 4 dereferenceable(4) %10)
          to label %44 unwind label %45

44:                                               ; preds = %43
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %10) #6
  br label %47

45:                                               ; preds = %43
  %46 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %10) #6
  br label %48

47:                                               ; preds = %44, %30
  call void @_ZNSt6vectorIS_I12StaticModIntIjLj998244353EESaIS1_EESaIS3_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %7) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %7) #6
  br label %69

48:                                               ; preds = %37, %39, %45, %41, %35
  %.pn13 = phi { ptr, i32 } [ %42, %41 ], [ %46, %45 ], [ %36, %35 ], [ %40, %39 ], [ %38, %37 ]
  call void @_ZNSt6vectorIS_I12StaticModIntIjLj998244353EESaIS1_EESaIS3_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %7) #6
  br label %49

49:                                               ; preds = %48, %33
  %.pn13.pn = phi { ptr, i32 } [ %.pn13, %48 ], [ %34, %33 ]
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %7) #6
  br label %74

50:                                               ; preds = %16
  %51 = load i32, ptr %5, align 4, !tbaa !5
  %52 = load i32, ptr %6, align 4, !tbaa !5
  %53 = invoke noundef zeroext i1 @_ZN17WeightedUnionFindI4ProdLb1EE4sameEii(ptr noundef nonnull align 8 dereferenceable(48) %3, i32 noundef %51, i32 noundef %52)
          to label %54 unwind label %31

54:                                               ; preds = %50
  br i1 %53, label %59, label %55

55:                                               ; preds = %54
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %11) #6
  store i32 -1, ptr %11, align 4, !tbaa !5
  invoke void @_Z5printIiEvRKT_(ptr noundef nonnull align 4 dereferenceable(4) %11)
          to label %56 unwind label %57

56:                                               ; preds = %55
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %11) #6
  br label %69

57:                                               ; preds = %55
  %58 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %11) #6
  br label %74

59:                                               ; preds = %54
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %12) #6
  %60 = load i32, ptr %5, align 4, !tbaa !5
  %61 = load i32, ptr %6, align 4, !tbaa !5
  invoke void @_ZN17WeightedUnionFindI4ProdLb1EE4diffEii(ptr dead_on_unwind nonnull writable sret(%struct.Matrix) align 8 %12, ptr noundef nonnull align 8 dereferenceable(48) %3, i32 noundef %60, i32 noundef %61)
          to label %62 unwind label %64

62:                                               ; preds = %59
  invoke void @_Z5printI6MatrixI12StaticModIntIjLj998244353EEEEvRKT_(ptr noundef nonnull align 8 dereferenceable(24) %12)
          to label %63 unwind label %66

63:                                               ; preds = %62
  call void @_ZNSt6vectorIS_I12StaticModIntIjLj998244353EESaIS1_EESaIS3_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %12) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %12) #6
  br label %69

64:                                               ; preds = %59
  %65 = landingpad { ptr, i32 }
          cleanup
  br label %68

66:                                               ; preds = %62
  %67 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt6vectorIS_I12StaticModIntIjLj998244353EESaIS1_EESaIS3_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %12) #6
  br label %68

68:                                               ; preds = %66, %64
  %.pn = phi { ptr, i32 } [ %67, %66 ], [ %65, %64 ]
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %12) #6
  br label %74

69:                                               ; preds = %56, %63, %47
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #6
  %70 = add nuw nsw i64 %.017, 1
  %71 = load i32, ptr %2, align 4, !tbaa !5
  %72 = sext i32 %71 to i64
  %73 = icmp slt i64 %70, %72
  br i1 %73, label %.lr.ph, label %._crit_edge, !llvm.loop !9

74:                                               ; preds = %68, %57, %49, %31
  %.pn13.pn.pn = phi { ptr, i32 } [ %.pn13.pn, %49 ], [ %.pn, %68 ], [ %58, %57 ], [ %32, %31 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #6
  call void @_ZN17WeightedUnionFindI4ProdLb1EED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %3) #6
  call void @llvm.lifetime.end.p0(i64 48, 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
  resume { ptr, i32 } %.pn13.pn.pn
}

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_Z4scanIiJiEEvRT_DpRT0_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN17WeightedUnionFindI4ProdLb1EEC2Ei(ptr noundef nonnull align 8 dereferenceable(48), i32 noundef) unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_Z4scanIiJiiEEvRT_DpRT0_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6MatrixI12StaticModIntIjLj998244353EEEC2Eii(ptr noundef nonnull align 8 dereferenceable(24), i32 noundef, i32 noundef) unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 4 dereferenceable(131089) ptr @_ZN6fastio7ScannerILm131072ELi16EErsI6MatrixI12StaticModIntIjLj998244353EEEEERS1_RT_(ptr noundef nonnull align 4 dereferenceable(131089), ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local i16 @_ZN17WeightedUnionFindI4ProdLb1EE5mergeEii6MatrixI12StaticModIntIjLj998244353EEE(ptr noundef nonnull align 8 dereferenceable(48), i32 noundef, i32 noundef, ptr noundef) local_unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN6MatrixI12StaticModIntIjLj998244353EEEC2ERKS2_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #2 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: inlinehint mustprogress uwtable
declare dso_local void @_Z5printIiEvRKT_(ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN17WeightedUnionFindI4ProdLb1EE4sameEii(ptr noundef nonnull align 8 dereferenceable(48), i32 noundef, i32 noundef) local_unnamed_addr #3 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN17WeightedUnionFindI4ProdLb1EE4diffEii(ptr dead_on_unwind noalias writable sret(%struct.Matrix) align 8, ptr noundef nonnull align 8 dereferenceable(48), i32 noundef, i32 noundef) local_unnamed_addr #3 align 2

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

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

attributes #0 = { 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { 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 #4 = { 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 #5 = { 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"}


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