; LLVM IR from bqi343/cp-notebook :: Contests/USACO Solutions/2018-19/Open 2019/Plat (escape (TLE))

; 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.DSU = type { [180000 x i32], [180000 x i32] }
%struct.modInt = type { i32 }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<std::array<int, 4>, std::allocator<std::array<int, 4>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::array<int, 4>, std::allocator<std::array<int, 4>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::array<int, 4>, std::allocator<std::array<int, 4>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::array<int, 4>, std::allocator<std::array<int, 4>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.17" = type { %"struct.std::_Vector_base.18" }
%"struct.std::_Vector_base.18" = type { %"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::basic_ostream" = type { ptr, %"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 }
%"struct.std::pair.23" = type { i32, i32 }

@D = external dso_local global %struct.DSU, align 4
@ans = external dso_local global %struct.modInt, align 4
@ed = external dso_local global %"class.std::vector", align 8
@cool = external dso_local global %"class.std::vector.17", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z4initv() #2

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z7processi(i32 noundef) #2

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #3 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca %"struct.std::pair.23", align 4
  %6 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  call void @_Z4initv()
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #4
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %7

7:                                                ; preds = %118, %0
  %8 = load i32, ptr %2, align 4, !tbaa !5
  %9 = call noundef i64 @_ZNKSt6vectorISt5arrayIiLm4EESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @ed) #4
  %10 = trunc i64 %9 to i32
  %11 = icmp slt i32 %8, %10
  br i1 %11, label %13, label %12

12:                                               ; preds = %7
  store i32 2, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #4
  br label %119

13:                                               ; preds = %7
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #4
  %14 = load i32, ptr %2, align 4, !tbaa !5
  store i32 %14, ptr %4, align 4, !tbaa !5
  br label %15

15:                                               ; preds = %34, %13
  %16 = load i32, ptr %2, align 4, !tbaa !5
  %17 = call noundef i64 @_ZNKSt6vectorISt5arrayIiLm4EESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @ed) #4
  %18 = trunc i64 %17 to i32
  %19 = icmp slt i32 %16, %18
  br i1 %19, label %20, label %32

20:                                               ; preds = %15
  %21 = load i32, ptr %2, align 4, !tbaa !5
  %22 = sext i32 %21 to i64
  %23 = call noundef nonnull align 4 dereferenceable(16) ptr @_ZNSt6vectorISt5arrayIiLm4EESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @ed, i64 noundef %22) #4
  %24 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIiLm4EEixEm(ptr noundef nonnull align 4 dereferenceable(16) %23, i64 noundef 0) #4
  %25 = load i32, ptr %24, align 4, !tbaa !5
  %26 = load i32, ptr %4, align 4, !tbaa !5
  %27 = sext i32 %26 to i64
  %28 = call noundef nonnull align 4 dereferenceable(16) ptr @_ZNSt6vectorISt5arrayIiLm4EESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @ed, i64 noundef %27) #4
  %29 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIiLm4EEixEm(ptr noundef nonnull align 4 dereferenceable(16) %28, i64 noundef 0) #4
  %30 = load i32, ptr %29, align 4, !tbaa !5
  %31 = icmp eq i32 %25, %30
  br label %32

32:                                               ; preds = %20, %15
  %33 = phi i1 [ false, %15 ], [ %31, %20 ]
  br i1 %33, label %34, label %45

34:                                               ; preds = %32
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #4
  %35 = load i32, ptr %2, align 4, !tbaa !5
  %36 = sext i32 %35 to i64
  %37 = call noundef nonnull align 4 dereferenceable(16) ptr @_ZNSt6vectorISt5arrayIiLm4EESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @ed, i64 noundef %36) #4
  %38 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIiLm4EEixEm(ptr noundef nonnull align 4 dereferenceable(16) %37, i64 noundef 2) #4
  %39 = load i32, ptr %2, align 4, !tbaa !5
  %40 = sext i32 %39 to i64
  %41 = call noundef nonnull align 4 dereferenceable(16) ptr @_ZNSt6vectorISt5arrayIiLm4EESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @ed, i64 noundef %40) #4
  %42 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIiLm4EEixEm(ptr noundef nonnull align 4 dereferenceable(16) %41, i64 noundef 1) #4
  call void @_ZNSt4pairIiiEC2IRiS2_TnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8) %5, ptr noundef nonnull align 4 dereferenceable(4) %38, ptr noundef nonnull align 4 dereferenceable(4) %42)
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24) @cool, ptr noundef nonnull align 4 dereferenceable(8) %5)
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #4
  %43 = load i32, ptr %2, align 4, !tbaa !5
  %44 = add nsw i32 %43, 1
  store i32 %44, ptr %2, align 4, !tbaa !5
  br label %15, !llvm.loop !9

45:                                               ; preds = %32
  %46 = load i32, ptr %4, align 4, !tbaa !5
  %47 = sext i32 %46 to i64
  %48 = call noundef nonnull align 4 dereferenceable(16) ptr @_ZNSt6vectorISt5arrayIiLm4EESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @ed, i64 noundef %47) #4
  %49 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIiLm4EEixEm(ptr noundef nonnull align 4 dereferenceable(16) %48, i64 noundef 0) #4
  %50 = load i32, ptr %49, align 4, !tbaa !5
  call void @_Z7processi(i32 noundef %50)
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EE5clearEv(ptr noundef nonnull align 8 dereferenceable(24) @cool) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  %51 = load i32, ptr %4, align 4, !tbaa !5
  store i32 %51, ptr %6, align 4, !tbaa !5
  br label %52

52:                                               ; preds = %115, %45
  %53 = load i32, ptr %6, align 4, !tbaa !5
  %54 = load i32, ptr %2, align 4, !tbaa !5
  %55 = icmp slt i32 %53, %54
  br i1 %55, label %57, label %56

56:                                               ; preds = %52
  store i32 6, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  br label %118

57:                                               ; preds = %52
  %58 = load i32, ptr %6, align 4, !tbaa !5
  %59 = sext i32 %58 to i64
  %60 = call noundef nonnull align 4 dereferenceable(16) ptr @_ZNSt6vectorISt5arrayIiLm4EESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @ed, i64 noundef %59) #4
  %61 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIiLm4EEixEm(ptr noundef nonnull align 4 dereferenceable(16) %60, i64 noundef 1) #4
  %62 = load i32, ptr %61, align 4, !tbaa !5
  %63 = icmp eq i32 %62, 0
  br i1 %63, label %64, label %89

64:                                               ; preds = %57
  %65 = load i32, ptr %6, align 4, !tbaa !5
  %66 = sext i32 %65 to i64
  %67 = call noundef nonnull align 4 dereferenceable(16) ptr @_ZNSt6vectorISt5arrayIiLm4EESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @ed, i64 noundef %66) #4
  %68 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIiLm4EEixEm(ptr noundef nonnull align 4 dereferenceable(16) %67, i64 noundef 2) #4
  %69 = load i32, ptr %68, align 4, !tbaa !5
  %70 = load i32, ptr %6, align 4, !tbaa !5
  %71 = sext i32 %70 to i64
  %72 = call noundef nonnull align 4 dereferenceable(16) ptr @_ZNSt6vectorISt5arrayIiLm4EESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @ed, i64 noundef %71) #4
  %73 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIiLm4EEixEm(ptr noundef nonnull align 4 dereferenceable(16) %72, i64 noundef 3) #4
  %74 = load i32, ptr %73, align 4, !tbaa !5
  %75 = call noundef i32 @_Z3hshii(i32 noundef %69, i32 noundef %74)
  %76 = load i32, ptr %6, align 4, !tbaa !5
  %77 = sext i32 %76 to i64
  %78 = call noundef nonnull align 4 dereferenceable(16) ptr @_ZNSt6vectorISt5arrayIiLm4EESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @ed, i64 noundef %77) #4
  %79 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIiLm4EEixEm(ptr noundef nonnull align 4 dereferenceable(16) %78, i64 noundef 2) #4
  %80 = load i32, ptr %79, align 4, !tbaa !5
  %81 = load i32, ptr %6, align 4, !tbaa !5
  %82 = sext i32 %81 to i64
  %83 = call noundef nonnull align 4 dereferenceable(16) ptr @_ZNSt6vectorISt5arrayIiLm4EESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @ed, i64 noundef %82) #4
  %84 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIiLm4EEixEm(ptr noundef nonnull align 4 dereferenceable(16) %83, i64 noundef 3) #4
  %85 = load i32, ptr %84, align 4, !tbaa !5
  %86 = add nsw i32 %85, 1
  %87 = call noundef i32 @_Z3hshii(i32 noundef %80, i32 noundef %86)
  %88 = call noundef zeroext i1 @_ZN3DSUILi180000EE5uniteEii(ptr noundef nonnull align 4 dereferenceable(1440000) @D, i32 noundef %75, i32 noundef %87)
  br label %114

89:                                               ; preds = %57
  %90 = load i32, ptr %6, align 4, !tbaa !5
  %91 = sext i32 %90 to i64
  %92 = call noundef nonnull align 4 dereferenceable(16) ptr @_ZNSt6vectorISt5arrayIiLm4EESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @ed, i64 noundef %91) #4
  %93 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIiLm4EEixEm(ptr noundef nonnull align 4 dereferenceable(16) %92, i64 noundef 2) #4
  %94 = load i32, ptr %93, align 4, !tbaa !5
  %95 = load i32, ptr %6, align 4, !tbaa !5
  %96 = sext i32 %95 to i64
  %97 = call noundef nonnull align 4 dereferenceable(16) ptr @_ZNSt6vectorISt5arrayIiLm4EESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @ed, i64 noundef %96) #4
  %98 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIiLm4EEixEm(ptr noundef nonnull align 4 dereferenceable(16) %97, i64 noundef 3) #4
  %99 = load i32, ptr %98, align 4, !tbaa !5
  %100 = call noundef i32 @_Z3hshii(i32 noundef %94, i32 noundef %99)
  %101 = load i32, ptr %6, align 4, !tbaa !5
  %102 = sext i32 %101 to i64
  %103 = call noundef nonnull align 4 dereferenceable(16) ptr @_ZNSt6vectorISt5arrayIiLm4EESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @ed, i64 noundef %102) #4
  %104 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIiLm4EEixEm(ptr noundef nonnull align 4 dereferenceable(16) %103, i64 noundef 2) #4
  %105 = load i32, ptr %104, align 4, !tbaa !5
  %106 = add nsw i32 %105, 1
  %107 = load i32, ptr %6, align 4, !tbaa !5
  %108 = sext i32 %107 to i64
  %109 = call noundef nonnull align 4 dereferenceable(16) ptr @_ZNSt6vectorISt5arrayIiLm4EESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @ed, i64 noundef %108) #4
  %110 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIiLm4EEixEm(ptr noundef nonnull align 4 dereferenceable(16) %109, i64 noundef 3) #4
  %111 = load i32, ptr %110, align 4, !tbaa !5
  %112 = call noundef i32 @_Z3hshii(i32 noundef %106, i32 noundef %111)
  %113 = call noundef zeroext i1 @_ZN3DSUILi180000EE5uniteEii(ptr noundef nonnull align 4 dereferenceable(1440000) @D, i32 noundef %100, i32 noundef %112)
  br label %114

114:                                              ; preds = %89, %64
  br label %115

115:                                              ; preds = %114
  %116 = load i32, ptr %6, align 4, !tbaa !5
  %117 = add nsw i32 %116, 1
  store i32 %117, ptr %6, align 4, !tbaa !5
  br label %52, !llvm.loop !11

118:                                              ; preds = %56
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #4
  br label %7, !llvm.loop !12

119:                                              ; preds = %12
  %120 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZlsRSoRK6modIntIiE(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull align 4 dereferenceable(4) @ans)
  %121 = load i32, ptr %1, align 4
  ret i32 %121
}

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(16) ptr @_ZNSt6vectorISt5arrayIiLm4EESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIiLm4EEixEm(ptr noundef nonnull align 4 dereferenceable(16), i64 noundef) #1 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt4pairIiiEC2IRiS2_TnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) unnamed_addr #1 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN3DSUILi180000EE5uniteEii(ptr noundef nonnull align 4 dereferenceable(1440000), i32 noundef, i32 noundef) #2 align 2

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

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

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

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


; 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.DSU = type { [180000 x i32], [180000 x i32] }
%struct.modInt = type { i32 }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<std::array<int, 4>, std::allocator<std::array<int, 4>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::array<int, 4>, std::allocator<std::array<int, 4>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::array<int, 4>, std::allocator<std::array<int, 4>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::array<int, 4>, std::allocator<std::array<int, 4>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.17" = type { %"struct.std::_Vector_base.18" }
%"struct.std::_Vector_base.18" = type { %"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::basic_ostream" = type { ptr, %"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 }
%"struct.std::pair.23" = type { i32, i32 }

@D = external dso_local global %struct.DSU, align 4
@ans = external dso_local global %struct.modInt, align 4
@ed = external dso_local global %"class.std::vector", align 8
@cool = external dso_local global %"class.std::vector.17", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z4initv() local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z7processi(i32 noundef) local_unnamed_addr #2

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #3 {
  %1 = alloca %"struct.std::pair.23", align 4
  tail call void @_Z4initv()
  %2 = tail call noundef i64 @_ZNKSt6vectorISt5arrayIiLm4EESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @ed) #4
  %3 = trunc i64 %2 to i32
  %4 = icmp sgt i32 %3, 0
  br i1 %4, label %.preheader, label %._crit_edge

.loopexit:                                        ; preds = %58, %.critedge
  %5 = call noundef i64 @_ZNKSt6vectorISt5arrayIiLm4EESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @ed) #4
  %6 = trunc i64 %5 to i32
  %7 = icmp slt i32 %.1.lcssa, %6
  br i1 %7, label %.preheader, label %._crit_edge, !llvm.loop !5

.preheader:                                       ; preds = %0, %.loopexit
  %.02329 = phi i32 [ %.1.lcssa, %.loopexit ], [ 0, %0 ]
  %8 = call noundef i64 @_ZNKSt6vectorISt5arrayIiLm4EESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @ed) #4
  %9 = trunc i64 %8 to i32
  %10 = icmp slt i32 %.02329, %9
  %11 = sext i32 %.02329 to i64
  br i1 %10, label %.lr.ph, label %.critedge

._crit_edge:                                      ; preds = %.loopexit, %0
  %12 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZlsRSoRK6modIntIiE(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull align 4 dereferenceable(4) @ans)
  ret i32 0

.lr.ph:                                           ; preds = %.preheader, %20
  %indvars.iv = phi i64 [ %indvars.iv.next, %20 ], [ %11, %.preheader ]
  %13 = call noundef nonnull align 4 dereferenceable(16) ptr @_ZNSt6vectorISt5arrayIiLm4EESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @ed, i64 noundef %indvars.iv) #4
  %14 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIiLm4EEixEm(ptr noundef nonnull align 4 dereferenceable(16) %13, i64 noundef 0) #4
  %15 = load i32, ptr %14, align 4, !tbaa !7
  %16 = call noundef nonnull align 4 dereferenceable(16) ptr @_ZNSt6vectorISt5arrayIiLm4EESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @ed, i64 noundef %11) #4
  %17 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIiLm4EEixEm(ptr noundef nonnull align 4 dereferenceable(16) %16, i64 noundef 0) #4
  %18 = load i32, ptr %17, align 4, !tbaa !7
  %19 = icmp eq i32 %15, %18
  br i1 %19, label %20, label %.critedge.loopexit

20:                                               ; preds = %.lr.ph
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #4
  %21 = call noundef nonnull align 4 dereferenceable(16) ptr @_ZNSt6vectorISt5arrayIiLm4EESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @ed, i64 noundef %indvars.iv) #4
  %22 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIiLm4EEixEm(ptr noundef nonnull align 4 dereferenceable(16) %21, i64 noundef 2) #4
  %23 = call noundef nonnull align 4 dereferenceable(16) ptr @_ZNSt6vectorISt5arrayIiLm4EESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @ed, i64 noundef %indvars.iv) #4
  %24 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIiLm4EEixEm(ptr noundef nonnull align 4 dereferenceable(16) %23, i64 noundef 1) #4
  call void @_ZNSt4pairIiiEC2IRiS2_TnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8) %1, ptr noundef nonnull align 4 dereferenceable(4) %22, ptr noundef nonnull align 4 dereferenceable(4) %24)
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24) @cool, ptr noundef nonnull align 4 dereferenceable(8) %1)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #4
  %indvars.iv.next = add nsw i64 %indvars.iv, 1
  %25 = call noundef i64 @_ZNKSt6vectorISt5arrayIiLm4EESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @ed) #4
  %sext = shl i64 %25, 32
  %26 = ashr exact i64 %sext, 32
  %27 = icmp slt i64 %indvars.iv.next, %26
  br i1 %27, label %.lr.ph, label %.critedge.loopexit, !llvm.loop !11

.critedge.loopexit:                               ; preds = %20, %.lr.ph
  %.1.lcssa.ph.in = phi i64 [ %indvars.iv, %.lr.ph ], [ %indvars.iv.next, %20 ]
  %.1.lcssa.ph = trunc i64 %.1.lcssa.ph.in to i32
  br label %.critedge

.critedge:                                        ; preds = %.preheader, %.critedge.loopexit
  %.1.lcssa = phi i32 [ %.1.lcssa.ph, %.critedge.loopexit ], [ %.02329, %.preheader ]
  %28 = call noundef nonnull align 4 dereferenceable(16) ptr @_ZNSt6vectorISt5arrayIiLm4EESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @ed, i64 noundef %11) #4
  %29 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIiLm4EEixEm(ptr noundef nonnull align 4 dereferenceable(16) %28, i64 noundef 0) #4
  %30 = load i32, ptr %29, align 4, !tbaa !7
  call void @_Z7processi(i32 noundef %30)
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EE5clearEv(ptr noundef nonnull align 8 dereferenceable(24) @cool) #4
  %31 = icmp slt i32 %.02329, %.1.lcssa
  br i1 %31, label %.lr.ph28, label %.loopexit

.lr.ph28:                                         ; preds = %.critedge, %58
  %indvars.iv31 = phi i64 [ %indvars.iv.next32, %58 ], [ %11, %.critedge ]
  %32 = call noundef nonnull align 4 dereferenceable(16) ptr @_ZNSt6vectorISt5arrayIiLm4EESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @ed, i64 noundef %indvars.iv31) #4
  %33 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIiLm4EEixEm(ptr noundef nonnull align 4 dereferenceable(16) %32, i64 noundef 1) #4
  %34 = load i32, ptr %33, align 4, !tbaa !7
  %35 = icmp eq i32 %34, 0
  %36 = call noundef nonnull align 4 dereferenceable(16) ptr @_ZNSt6vectorISt5arrayIiLm4EESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @ed, i64 noundef %indvars.iv31) #4
  %37 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIiLm4EEixEm(ptr noundef nonnull align 4 dereferenceable(16) %36, i64 noundef 2) #4
  %38 = load i32, ptr %37, align 4, !tbaa !7
  %39 = call noundef nonnull align 4 dereferenceable(16) ptr @_ZNSt6vectorISt5arrayIiLm4EESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @ed, i64 noundef %indvars.iv31) #4
  %40 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIiLm4EEixEm(ptr noundef nonnull align 4 dereferenceable(16) %39, i64 noundef 3) #4
  %41 = load i32, ptr %40, align 4, !tbaa !7
  %42 = call noundef i32 @_Z3hshii(i32 noundef %38, i32 noundef %41)
  %43 = call noundef nonnull align 4 dereferenceable(16) ptr @_ZNSt6vectorISt5arrayIiLm4EESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @ed, i64 noundef %indvars.iv31) #4
  %44 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIiLm4EEixEm(ptr noundef nonnull align 4 dereferenceable(16) %43, i64 noundef 2) #4
  %45 = load i32, ptr %44, align 4, !tbaa !7
  br i1 %35, label %46, label %52

46:                                               ; preds = %.lr.ph28
  %47 = call noundef nonnull align 4 dereferenceable(16) ptr @_ZNSt6vectorISt5arrayIiLm4EESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @ed, i64 noundef %indvars.iv31) #4
  %48 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIiLm4EEixEm(ptr noundef nonnull align 4 dereferenceable(16) %47, i64 noundef 3) #4
  %49 = load i32, ptr %48, align 4, !tbaa !7
  %50 = add nsw i32 %49, 1
  %51 = call noundef i32 @_Z3hshii(i32 noundef %45, i32 noundef %50)
  br label %58

52:                                               ; preds = %.lr.ph28
  %53 = add nsw i32 %45, 1
  %54 = call noundef nonnull align 4 dereferenceable(16) ptr @_ZNSt6vectorISt5arrayIiLm4EESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @ed, i64 noundef %indvars.iv31) #4
  %55 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIiLm4EEixEm(ptr noundef nonnull align 4 dereferenceable(16) %54, i64 noundef 3) #4
  %56 = load i32, ptr %55, align 4, !tbaa !7
  %57 = call noundef i32 @_Z3hshii(i32 noundef %53, i32 noundef %56)
  br label %58

58:                                               ; preds = %46, %52
  %.sink = phi i32 [ %51, %46 ], [ %57, %52 ]
  %59 = call noundef zeroext i1 @_ZN3DSUILi180000EE5uniteEii(ptr noundef nonnull align 4 dereferenceable(1440000) @D, i32 noundef %42, i32 noundef %.sink)
  %indvars.iv.next32 = add nsw i64 %indvars.iv31, 1
  %lftr.wideiv = trunc i64 %indvars.iv.next32 to i32
  %exitcond.not = icmp eq i32 %.1.lcssa, %lftr.wideiv
  br i1 %exitcond.not, label %.loopexit, label %.lr.ph28, !llvm.loop !12
}

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(16) ptr @_ZNSt6vectorISt5arrayIiLm4EESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIiLm4EEixEm(ptr noundef nonnull align 4 dereferenceable(16), i64 noundef) local_unnamed_addr #1 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt4pairIiiEC2IRiS2_TnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) unnamed_addr #1 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN3DSUILi180000EE5uniteEii(ptr noundef nonnull align 4 dereferenceable(1440000), i32 noundef, i32 noundef) local_unnamed_addr #2 align 2

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!8, !8, i64 0}
!8 = !{!"int", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = distinct !{!11, !6}
!12 = distinct !{!12, !6}


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