; LLVM IR from tangjz/acm-icpc :: 51nod/1078.ll (Z6tarjani)

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

%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.__gnu_cxx::__normal_iterator" = type { ptr }

@m = external dso_local global i32, align 4
@tim = external dso_local global [50001 x i32], align 16
@dsu = external dso_local global [2 x [50001 x i32]], align 16
@fa = external dso_local global [50001 x i32], align 16
@low = external dso_local global [2 x [50001 x i32]], align 16
@e = external dso_local global [50001 x %"class.std::vector"], align 16
@g = external dso_local global [50001 x %"class.std::vector"], align 16

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z9dsu_mergePiii(ptr noundef, i32 noundef, i32 noundef) #1

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

; Function Attrs: mustprogress uwtable
define dso_local void @_Z6tarjani(i32 noundef %0) #1 {
  %2 = alloca i32, align 4
  %3 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %4 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %9 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %10 = alloca i32, align 4
  %11 = alloca %"class.std::vector", align 8
  store i32 %0, ptr %2, align 4, !tbaa !5
  %12 = load i32, ptr @m, align 4, !tbaa !5
  %13 = add nsw i32 %12, 1
  store i32 %13, ptr @m, align 4, !tbaa !5
  %14 = load i32, ptr %2, align 4, !tbaa !5
  %15 = sext i32 %14 to i64
  %16 = getelementptr inbounds [50001 x i32], ptr @tim, i64 0, i64 %15
  store i32 %13, ptr %16, align 4, !tbaa !5
  %17 = load i32, ptr %2, align 4, !tbaa !5
  %18 = load i32, ptr %2, align 4, !tbaa !5
  %19 = sext i32 %18 to i64
  %20 = getelementptr inbounds [50001 x i32], ptr getelementptr inbounds ([2 x [50001 x i32]], ptr @low, i64 0, i64 1), i64 0, i64 %19
  store i32 %17, ptr %20, align 4, !tbaa !5
  %21 = load i32, ptr %2, align 4, !tbaa !5
  %22 = sext i32 %21 to i64
  %23 = getelementptr inbounds [50001 x i32], ptr @low, i64 0, i64 %22
  store i32 %17, ptr %23, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #6
  %24 = load i32, ptr %2, align 4, !tbaa !5
  %25 = sext i32 %24 to i64
  %26 = getelementptr inbounds [50001 x %"class.std::vector"], ptr @e, i64 0, i64 %25
  %27 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %26) #6
  %28 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %3, i32 0, i32 0
  store ptr %27, ptr %28, align 8
  br label %29

29:                                               ; preds = %148, %1
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #6
  %30 = load i32, ptr %2, align 4, !tbaa !5
  %31 = sext i32 %30 to i64
  %32 = getelementptr inbounds [50001 x %"class.std::vector"], ptr @e, i64 0, i64 %31
  %33 = call ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %32) #6
  %34 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %4, i32 0, i32 0
  store ptr %33, ptr %34, align 8
  %35 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPiSt6vectorIiSaIiEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 8 dereferenceable(8) %4) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #6
  br i1 %35, label %37, label %36

36:                                               ; preds = %29
  store i32 2, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #6
  br label %150

37:                                               ; preds = %29
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  %38 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %3) #6
  %39 = load i32, ptr %38, align 4, !tbaa !5
  store i32 %39, ptr %6, align 4, !tbaa !5
  %40 = load i32, ptr %6, align 4, !tbaa !5
  %41 = load i32, ptr %2, align 4, !tbaa !5
  %42 = sext i32 %41 to i64
  %43 = getelementptr inbounds [50001 x i32], ptr @fa, i64 0, i64 %42
  %44 = load i32, ptr %43, align 4, !tbaa !5
  %45 = icmp eq i32 %40, %44
  br i1 %45, label %46, label %47

46:                                               ; preds = %37
  store i32 4, ptr %5, align 4
  br label %145

47:                                               ; preds = %37
  %48 = load i32, ptr %6, align 4, !tbaa !5
  %49 = sext i32 %48 to i64
  %50 = getelementptr inbounds [50001 x i32], ptr @tim, i64 0, i64 %49
  %51 = load i32, ptr %50, align 4, !tbaa !5
  %52 = icmp ne i32 %51, 0
  br i1 %52, label %127, label %53

53:                                               ; preds = %47
  %54 = load i32, ptr %2, align 4, !tbaa !5
  %55 = load i32, ptr %6, align 4, !tbaa !5
  %56 = sext i32 %55 to i64
  %57 = getelementptr inbounds [50001 x i32], ptr @fa, i64 0, i64 %56
  store i32 %54, ptr %57, align 4, !tbaa !5
  %58 = load i32, ptr %6, align 4, !tbaa !5
  call void @_Z6tarjani(i32 noundef %58)
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  %59 = load i32, ptr %2, align 4, !tbaa !5
  store i32 %59, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #6
  %60 = load i32, ptr %2, align 4, !tbaa !5
  %61 = sext i32 %60 to i64
  %62 = getelementptr inbounds [50001 x %"class.std::vector"], ptr @g, i64 0, i64 %61
  %63 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %62) #6
  %64 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %8, i32 0, i32 0
  store ptr %63, ptr %64, align 8
  br label %65

65:                                               ; preds = %114, %53
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #6
  %66 = load i32, ptr %2, align 4, !tbaa !5
  %67 = sext i32 %66 to i64
  %68 = getelementptr inbounds [50001 x %"class.std::vector"], ptr @g, i64 0, i64 %67
  %69 = call ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %68) #6
  %70 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %9, i32 0, i32 0
  store ptr %69, ptr %70, align 8
  %71 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPiSt6vectorIiSaIiEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %8, ptr noundef nonnull align 8 dereferenceable(8) %9) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  br i1 %71, label %73, label %72

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

73:                                               ; preds = %65
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  %74 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %8) #6
  %75 = load i32, ptr %74, align 4, !tbaa !5
  %76 = call noundef nonnull align 4 dereferenceable(4) ptr @_Z8bin_rooti(i32 noundef %75)
  %77 = load i32, ptr %76, align 4, !tbaa !5
  store i32 %77, ptr %10, align 4, !tbaa !5
  br label %78

78:                                               ; preds = %106, %73
  %79 = load i32, ptr %10, align 4, !tbaa !5
  %80 = load i32, ptr %2, align 4, !tbaa !5
  %81 = call noundef nonnull align 4 dereferenceable(4) ptr @_Z8bin_rooti(i32 noundef %80)
  %82 = load i32, ptr %81, align 4, !tbaa !5
  %83 = icmp ne i32 %79, %82
  br i1 %83, label %85, label %84

84:                                               ; preds = %78
  store i32 8, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  br label %113

85:                                               ; preds = %78
  %86 = load i32, ptr %10, align 4, !tbaa !5
  %87 = sext i32 %86 to i64
  %88 = getelementptr inbounds [50001 x i32], ptr getelementptr inbounds ([2 x [50001 x i32]], ptr @low, i64 0, i64 1), i64 0, i64 %87
  %89 = load i32, ptr %88, align 4, !tbaa !5
  %90 = sext i32 %89 to i64
  %91 = getelementptr inbounds [50001 x i32], ptr @tim, i64 0, i64 %90
  %92 = load i32, ptr %91, align 4, !tbaa !5
  %93 = load i32, ptr %7, align 4, !tbaa !5
  %94 = sext i32 %93 to i64
  %95 = getelementptr inbounds [50001 x i32], ptr @tim, i64 0, i64 %94
  %96 = load i32, ptr %95, align 4, !tbaa !5
  %97 = icmp slt i32 %92, %96
  br i1 %97, label %98, label %103

98:                                               ; preds = %85
  %99 = load i32, ptr %10, align 4, !tbaa !5
  %100 = sext i32 %99 to i64
  %101 = getelementptr inbounds [50001 x i32], ptr getelementptr inbounds ([2 x [50001 x i32]], ptr @low, i64 0, i64 1), i64 0, i64 %100
  %102 = load i32, ptr %101, align 4, !tbaa !5
  store i32 %102, ptr %7, align 4, !tbaa !5
  br label %103

103:                                              ; preds = %98, %85
  %104 = load i32, ptr %2, align 4, !tbaa !5
  %105 = load i32, ptr %10, align 4, !tbaa !5
  call void @_Z9dsu_mergePiii(ptr noundef @dsu, i32 noundef %104, i32 noundef %105)
  br label %106

106:                                              ; preds = %103
  %107 = load i32, ptr %10, align 4, !tbaa !5
  %108 = sext i32 %107 to i64
  %109 = getelementptr inbounds [50001 x i32], ptr @fa, i64 0, i64 %108
  %110 = load i32, ptr %109, align 4, !tbaa !5
  %111 = call noundef nonnull align 4 dereferenceable(4) ptr @_Z8bin_rooti(i32 noundef %110)
  %112 = load i32, ptr %111, align 4, !tbaa !5
  store i32 %112, ptr %10, align 4, !tbaa !5
  br label %78, !llvm.loop !9

113:                                              ; preds = %84
  br label %114

114:                                              ; preds = %113
  %115 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %8) #6
  br label %65, !llvm.loop !11

116:                                              ; preds = %72
  call void @llvm.lifetime.start.p0(i64 24, ptr %11) #6
  call void @llvm.memset.p0.i64(ptr align 8 %11, i8 0, i64 24, i1 false)
  call void @_ZNSt6vectorIiSaIiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %11) #6
  %117 = load i32, ptr %2, align 4, !tbaa !5
  %118 = sext i32 %117 to i64
  %119 = getelementptr inbounds [50001 x %"class.std::vector"], ptr @g, i64 0, i64 %118
  call void @_ZNSt6vectorIiSaIiEE4swapERS1_(ptr noundef nonnull align 8 dereferenceable(24) %11, ptr noundef nonnull align 8 dereferenceable(24) %119) #6
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %11) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr %11) #6
  %120 = load i32, ptr %2, align 4, !tbaa !5
  %121 = load i32, ptr %6, align 4, !tbaa !5
  %122 = sext i32 %121 to i64
  %123 = getelementptr inbounds [50001 x i32], ptr @low, i64 0, i64 %122
  %124 = load i32, ptr %123, align 4, !tbaa !5
  call void @_Z7low_updii(i32 noundef %120, i32 noundef %124)
  %125 = load i32, ptr %2, align 4, !tbaa !5
  %126 = load i32, ptr %7, align 4, !tbaa !5
  call void @_Z7low_updii(i32 noundef %125, i32 noundef %126)
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  br label %144

127:                                              ; preds = %47
  %128 = load i32, ptr %6, align 4, !tbaa !5
  %129 = sext i32 %128 to i64
  %130 = getelementptr inbounds [50001 x i32], ptr @tim, i64 0, i64 %129
  %131 = load i32, ptr %130, align 4, !tbaa !5
  %132 = load i32, ptr %2, align 4, !tbaa !5
  %133 = sext i32 %132 to i64
  %134 = getelementptr inbounds [50001 x i32], ptr @tim, i64 0, i64 %133
  %135 = load i32, ptr %134, align 4, !tbaa !5
  %136 = icmp slt i32 %131, %135
  br i1 %136, label %137, label %143

137:                                              ; preds = %127
  %138 = load i32, ptr %2, align 4, !tbaa !5
  %139 = load i32, ptr %6, align 4, !tbaa !5
  call void @_Z7low_updii(i32 noundef %138, i32 noundef %139)
  %140 = load i32, ptr %6, align 4, !tbaa !5
  %141 = sext i32 %140 to i64
  %142 = getelementptr inbounds [50001 x %"class.std::vector"], ptr @g, i64 0, i64 %141
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %142, ptr noundef nonnull align 4 dereferenceable(4) %2)
  br label %143

143:                                              ; preds = %137, %127
  br label %144

144:                                              ; preds = %143, %116
  store i32 0, ptr %5, align 4
  br label %145

145:                                              ; preds = %144, %46
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  %146 = load i32, ptr %5, align 4
  switch i32 %146, label %159 [
    i32 0, label %147
    i32 4, label %148
  ]

147:                                              ; preds = %145
  br label %148

148:                                              ; preds = %147, %145
  %149 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %3) #6
  br label %29, !llvm.loop !12

150:                                              ; preds = %36
  %151 = load i32, ptr %2, align 4, !tbaa !5
  %152 = load i32, ptr %2, align 4, !tbaa !5
  %153 = call noundef nonnull align 4 dereferenceable(4) ptr @_Z8bin_rooti(i32 noundef %152)
  store i32 %151, ptr %153, align 4, !tbaa !5
  %154 = load i32, ptr %2, align 4, !tbaa !5
  %155 = load i32, ptr %2, align 4, !tbaa !5
  %156 = sext i32 %155 to i64
  %157 = getelementptr inbounds [50001 x i32], ptr getelementptr inbounds ([2 x [50001 x i32]], ptr @low, i64 0, i64 1), i64 0, i64 %156
  %158 = load i32, ptr %157, align 4, !tbaa !5
  call void @_Z9dsu_mergePiii(ptr noundef getelementptr inbounds ([2 x [50001 x i32]], ptr @dsu, i64 0, i64 1), i32 noundef %154, i32 noundef %158)
  ret void

159:                                              ; preds = %145
  unreachable
}

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN9__gnu_cxxneIPiSt6vectorIiSaIiEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #3

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_Z8bin_rooti(i32 noundef) #4

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

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

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

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

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

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

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


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.__gnu_cxx::__normal_iterator" = type { ptr }

@m = external dso_local local_unnamed_addr global i32, align 4
@tim = external dso_local local_unnamed_addr global [50001 x i32], align 16
@dsu = external dso_local global [2 x [50001 x i32]], align 16
@fa = external dso_local local_unnamed_addr global [50001 x i32], align 16
@low = external dso_local local_unnamed_addr global [2 x [50001 x i32]], align 16
@e = external dso_local global [50001 x %"class.std::vector"], align 16
@g = external dso_local global [50001 x %"class.std::vector"], align 16

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z9dsu_mergePiii(ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #1

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

; Function Attrs: mustprogress uwtable
define dso_local void @_Z6tarjani(i32 noundef %0) local_unnamed_addr #1 {
  %2 = alloca i32, align 4
  %3 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %4 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %5 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %6 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %7 = alloca %"class.std::vector", align 8
  store i32 %0, ptr %2, align 4, !tbaa !5
  %8 = load i32, ptr @m, align 4, !tbaa !5
  %9 = add nsw i32 %8, 1
  store i32 %9, ptr @m, align 4, !tbaa !5
  %10 = sext i32 %0 to i64
  %11 = getelementptr inbounds [50001 x i32], ptr @tim, i64 0, i64 %10
  store i32 %9, ptr %11, align 4, !tbaa !5
  %12 = getelementptr inbounds [50001 x i32], ptr getelementptr inbounds (i8, ptr @low, i64 200004), i64 0, i64 %10
  store i32 %0, ptr %12, align 4, !tbaa !5
  %13 = getelementptr inbounds [50001 x i32], ptr @low, i64 0, i64 %10
  store i32 %0, ptr %13, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #6
  %14 = getelementptr inbounds [50001 x %"class.std::vector"], ptr @e, i64 0, i64 %10
  %15 = tail call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %14) #6
  store ptr %15, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #6
  %16 = tail call ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %14) #6
  store ptr %16, ptr %4, align 8
  %17 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPiSt6vectorIiSaIiEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 8 dereferenceable(8) %4) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #6
  br i1 %17, label %.lr.ph29, label %._crit_edge30

._crit_edge30.loopexit:                           ; preds = %88
  %.pre = load i32, ptr %2, align 4, !tbaa !5
  br label %._crit_edge30

._crit_edge30:                                    ; preds = %._crit_edge30.loopexit, %1
  %18 = phi i32 [ %.pre, %._crit_edge30.loopexit ], [ %0, %1 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #6
  %19 = call noundef nonnull align 4 dereferenceable(4) ptr @_Z8bin_rooti(i32 noundef %18)
  store i32 %18, ptr %19, align 4, !tbaa !5
  %20 = load i32, ptr %2, align 4, !tbaa !5
  %21 = sext i32 %20 to i64
  %22 = getelementptr inbounds [50001 x i32], ptr getelementptr inbounds (i8, ptr @low, i64 200004), i64 0, i64 %21
  %23 = load i32, ptr %22, align 4, !tbaa !5
  call void @_Z9dsu_mergePiii(ptr noundef nonnull getelementptr inbounds (i8, ptr @dsu, i64 200004), i32 noundef %20, i32 noundef %23)
  ret void

.lr.ph29:                                         ; preds = %1, %88
  %24 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %3) #6
  %25 = load i32, ptr %24, align 4, !tbaa !5
  %26 = load i32, ptr %2, align 4, !tbaa !5
  %27 = sext i32 %26 to i64
  %28 = getelementptr inbounds [50001 x i32], ptr @fa, i64 0, i64 %27
  %29 = load i32, ptr %28, align 4, !tbaa !5
  %30 = icmp eq i32 %25, %29
  br i1 %30, label %88, label %31

31:                                               ; preds = %.lr.ph29
  %32 = sext i32 %25 to i64
  %33 = getelementptr inbounds [50001 x i32], ptr @tim, i64 0, i64 %32
  %34 = load i32, ptr %33, align 4, !tbaa !5
  %.not = icmp eq i32 %34, 0
  br i1 %.not, label %35, label %82

35:                                               ; preds = %31
  %36 = getelementptr inbounds [50001 x i32], ptr @fa, i64 0, i64 %32
  store i32 %26, ptr %36, align 4, !tbaa !5
  call void @_Z6tarjani(i32 noundef %25)
  %37 = load i32, ptr %2, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #6
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds [50001 x %"class.std::vector"], ptr @g, i64 0, i64 %38
  %40 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %39) #6
  store ptr %40, ptr %5, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #6
  %41 = load i32, ptr %2, align 4, !tbaa !5
  %42 = sext i32 %41 to i64
  %43 = getelementptr inbounds [50001 x %"class.std::vector"], ptr @g, i64 0, i64 %42
  %44 = call ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %43) #6
  store ptr %44, ptr %6, align 8
  %45 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPiSt6vectorIiSaIiEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef nonnull align 8 dereferenceable(8) %6) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #6
  br i1 %45, label %.lr.ph25, label %._crit_edge26

._crit_edge26:                                    ; preds = %._crit_edge, %35
  %.015.lcssa = phi i32 [ %37, %35 ], [ %.1.lcssa, %._crit_edge ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #6
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %7) #6
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %7, i8 0, i64 24, i1 false)
  call void @_ZNSt6vectorIiSaIiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %7) #6
  %46 = load i32, ptr %2, align 4, !tbaa !5
  %47 = sext i32 %46 to i64
  %48 = getelementptr inbounds [50001 x %"class.std::vector"], ptr @g, i64 0, i64 %47
  call void @_ZNSt6vectorIiSaIiEE4swapERS1_(ptr noundef nonnull align 8 dereferenceable(24) %7, ptr noundef nonnull align 8 dereferenceable(24) %48) #6
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %7) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %7) #6
  %49 = load i32, ptr %2, align 4, !tbaa !5
  %50 = getelementptr inbounds [50001 x i32], ptr @low, i64 0, i64 %32
  %51 = load i32, ptr %50, align 4, !tbaa !5
  call void @_Z7low_updii(i32 noundef %49, i32 noundef %51)
  %52 = load i32, ptr %2, align 4, !tbaa !5
  call void @_Z7low_updii(i32 noundef %52, i32 noundef %.015.lcssa)
  br label %88

.lr.ph25:                                         ; preds = %35, %._crit_edge
  %.01523 = phi i32 [ %.1.lcssa, %._crit_edge ], [ %37, %35 ]
  %53 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %5) #6
  %54 = load i32, ptr %53, align 4, !tbaa !5
  %55 = call noundef nonnull align 4 dereferenceable(4) ptr @_Z8bin_rooti(i32 noundef %54)
  %.019 = load i32, ptr %55, align 4, !tbaa !5
  %56 = load i32, ptr %2, align 4, !tbaa !5
  %57 = call noundef nonnull align 4 dereferenceable(4) ptr @_Z8bin_rooti(i32 noundef %56)
  %58 = load i32, ptr %57, align 4, !tbaa !5
  %.not1820 = icmp eq i32 %.019, %58
  br i1 %.not1820, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %.lr.ph, %.lr.ph25
  %.1.lcssa = phi i32 [ %.01523, %.lr.ph25 ], [ %spec.select, %.lr.ph ]
  %59 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %5) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #6
  %60 = load i32, ptr %2, align 4, !tbaa !5
  %61 = sext i32 %60 to i64
  %62 = getelementptr inbounds [50001 x %"class.std::vector"], ptr @g, i64 0, i64 %61
  %63 = call ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %62) #6
  store ptr %63, ptr %6, align 8
  %64 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPiSt6vectorIiSaIiEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef nonnull align 8 dereferenceable(8) %6) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #6
  br i1 %64, label %.lr.ph25, label %._crit_edge26, !llvm.loop !9

.lr.ph:                                           ; preds = %.lr.ph25, %.lr.ph
  %.022 = phi i32 [ %.0, %.lr.ph ], [ %.019, %.lr.ph25 ]
  %.121 = phi i32 [ %spec.select, %.lr.ph ], [ %.01523, %.lr.ph25 ]
  %65 = sext i32 %.022 to i64
  %66 = getelementptr inbounds [50001 x i32], ptr getelementptr inbounds (i8, ptr @low, i64 200004), i64 0, i64 %65
  %67 = load i32, ptr %66, align 4, !tbaa !5
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds [50001 x i32], ptr @tim, i64 0, i64 %68
  %70 = load i32, ptr %69, align 4, !tbaa !5
  %71 = sext i32 %.121 to i64
  %72 = getelementptr inbounds [50001 x i32], ptr @tim, i64 0, i64 %71
  %73 = load i32, ptr %72, align 4, !tbaa !5
  %74 = icmp slt i32 %70, %73
  %spec.select = select i1 %74, i32 %67, i32 %.121
  %75 = load i32, ptr %2, align 4, !tbaa !5
  call void @_Z9dsu_mergePiii(ptr noundef nonnull @dsu, i32 noundef %75, i32 noundef %.022)
  %76 = getelementptr inbounds [50001 x i32], ptr @fa, i64 0, i64 %65
  %77 = load i32, ptr %76, align 4, !tbaa !5
  %78 = call noundef nonnull align 4 dereferenceable(4) ptr @_Z8bin_rooti(i32 noundef %77)
  %.0 = load i32, ptr %78, align 4, !tbaa !5
  %79 = load i32, ptr %2, align 4, !tbaa !5
  %80 = call noundef nonnull align 4 dereferenceable(4) ptr @_Z8bin_rooti(i32 noundef %79)
  %81 = load i32, ptr %80, align 4, !tbaa !5
  %.not18 = icmp eq i32 %.0, %81
  br i1 %.not18, label %._crit_edge, label %.lr.ph, !llvm.loop !11

82:                                               ; preds = %31
  %83 = getelementptr inbounds [50001 x i32], ptr @tim, i64 0, i64 %27
  %84 = load i32, ptr %83, align 4, !tbaa !5
  %85 = icmp slt i32 %34, %84
  br i1 %85, label %86, label %88

86:                                               ; preds = %82
  call void @_Z7low_updii(i32 noundef %26, i32 noundef %25)
  %87 = getelementptr inbounds [50001 x %"class.std::vector"], ptr @g, i64 0, i64 %32
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %87, ptr noundef nonnull align 4 dereferenceable(4) %2)
  br label %88

88:                                               ; preds = %._crit_edge26, %86, %82, %.lr.ph29
  %89 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %3) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #6
  %90 = load i32, ptr %2, align 4, !tbaa !5
  %91 = sext i32 %90 to i64
  %92 = getelementptr inbounds [50001 x %"class.std::vector"], ptr @e, i64 0, i64 %91
  %93 = call ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %92) #6
  store ptr %93, ptr %4, align 8
  %94 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPiSt6vectorIiSaIiEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 8 dereferenceable(8) %4) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #6
  br i1 %94, label %.lr.ph29, label %._crit_edge30.loopexit, !llvm.loop !12
}

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN9__gnu_cxxneIPiSt6vectorIiSaIiEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24)) 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) #2

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_Z8bin_rooti(i32 noundef) local_unnamed_addr #4

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

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

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

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

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

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

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


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