; LLVM IR from bqi343/cp-notebook :: Contests/USACO Solutions/2008-09 (cheer)

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

%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<std::array<int, 3>, std::allocator<std::array<int, 3>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::array<int, 3>, std::allocator<std::array<int, 3>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::array<int, 3>, std::allocator<std::array<int, 3>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::array<int, 3>, std::allocator<std::array<int, 3>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%"class.std::allocator" = type { i8 }
%"struct.std::array" = type { [3 x i32] }

@N = external dso_local global i32, align 4
@P = external dso_local global i32, align 4
@C = external dso_local global [10001 x i32], align 16
@v = external dso_local global %"class.std::vector", align 8
@.str.6 = external hidden unnamed_addr constant [6 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN2io5setIOENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef) #0

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #1 align 2

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #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 uwtable
declare dso_local noundef i64 @_Z7kruskalSt6vectorISt5arrayIiLm3EESaIS1_EE(ptr noundef) #0

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #3 personality ptr @__gxx_personality_v0 {
  %1 = alloca i32, align 4
  %2 = alloca %"class.std::__cxx11::basic_string", align 8
  %3 = alloca %"class.std::allocator", align 1
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca %"struct.std::array", align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i64, align 8
  %15 = alloca %"class.std::vector", align 8
  %16 = alloca i64, align 8
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 1, ptr %3) #4
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %3) #4
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %2, ptr noundef @.str.6, ptr noundef nonnull align 1 dereferenceable(1) %3)
          to label %17 unwind label %25

17:                                               ; preds = %0
  invoke void @_ZN2io5setIOENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef %2)
          to label %18 unwind label %29

18:                                               ; preds = %17
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %2) #4
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %3) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr %3) #4
  call void @_ZN2io2reIiJiEEEvRT_DpRT0_(ptr noundef nonnull align 4 dereferenceable(4) @N, ptr noundef nonnull align 4 dereferenceable(4) @P)
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  store i32 1, ptr %6, align 4, !tbaa !5
  br label %19

19:                                               ; preds = %38, %18
  %20 = load i32, ptr %6, align 4, !tbaa !5
  %21 = load i32, ptr @N, align 4, !tbaa !5
  %22 = add nsw i32 %21, 1
  %23 = icmp slt i32 %20, %22
  br i1 %23, label %34, label %24

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

25:                                               ; preds = %0
  %26 = landingpad { ptr, i32 }
          cleanup
  %27 = extractvalue { ptr, i32 } %26, 0
  store ptr %27, ptr %4, align 8
  %28 = extractvalue { ptr, i32 } %26, 1
  store i32 %28, ptr %5, align 4
  br label %33

29:                                               ; preds = %17
  %30 = landingpad { ptr, i32 }
          cleanup
  %31 = extractvalue { ptr, i32 } %30, 0
  store ptr %31, ptr %4, align 8
  %32 = extractvalue { ptr, i32 } %30, 1
  store i32 %32, ptr %5, align 4
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %2) #4
  br label %33

33:                                               ; preds = %29, %25
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %3) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr %3) #4
  br label %106

34:                                               ; preds = %19
  %35 = load i32, ptr %6, align 4, !tbaa !5
  %36 = sext i32 %35 to i64
  %37 = getelementptr inbounds [10001 x i32], ptr @C, i64 0, i64 %36
  call void @_ZN2io2reIiEEvRT_(ptr noundef nonnull align 4 dereferenceable(4) %37)
  br label %38

38:                                               ; preds = %34
  %39 = load i32, ptr %6, align 4, !tbaa !5
  %40 = add nsw i32 %39, 1
  store i32 %40, ptr %6, align 4, !tbaa !5
  br label %19, !llvm.loop !9

41:                                               ; preds = %24
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  store i32 0, ptr %7, align 4, !tbaa !5
  br label %42

42:                                               ; preds = %65, %41
  %43 = load i32, ptr %7, align 4, !tbaa !5
  %44 = load i32, ptr @P, align 4, !tbaa !5
  %45 = icmp slt i32 %43, %44
  br i1 %45, label %47, label %46

46:                                               ; preds = %42
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  br label %68

47:                                               ; preds = %42
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  call void @_ZN2io2reIiJiiEEEvRT_DpRT0_(ptr noundef nonnull align 4 dereferenceable(4) %8, ptr noundef nonnull align 4 dereferenceable(4) %9, ptr noundef nonnull align 4 dereferenceable(4) %10)
  call void @llvm.lifetime.start.p0(i64 12, ptr %11) #4
  %48 = getelementptr inbounds %"struct.std::array", ptr %11, i32 0, i32 0
  %49 = load i32, ptr %10, align 4, !tbaa !5
  %50 = mul nsw i32 2, %49
  %51 = load i32, ptr %8, align 4, !tbaa !5
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds [10001 x i32], ptr @C, i64 0, i64 %52
  %54 = load i32, ptr %53, align 4, !tbaa !5
  %55 = add nsw i32 %50, %54
  %56 = load i32, ptr %9, align 4, !tbaa !5
  %57 = sext i32 %56 to i64
  %58 = getelementptr inbounds [10001 x i32], ptr @C, i64 0, i64 %57
  %59 = load i32, ptr %58, align 4, !tbaa !5
  %60 = add nsw i32 %55, %59
  store i32 %60, ptr %48, align 4, !tbaa !5
  %61 = getelementptr inbounds i32, ptr %48, i64 1
  %62 = load i32, ptr %8, align 4, !tbaa !5
  store i32 %62, ptr %61, align 4, !tbaa !5
  %63 = getelementptr inbounds i32, ptr %48, i64 2
  %64 = load i32, ptr %9, align 4, !tbaa !5
  store i32 %64, ptr %63, align 4, !tbaa !5
  call void @_ZNSt6vectorISt5arrayIiLm3EESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24) @v, ptr noundef nonnull align 4 dereferenceable(12) %11)
  call void @llvm.lifetime.end.p0(i64 12, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  br label %65

65:                                               ; preds = %47
  %66 = load i32, ptr %7, align 4, !tbaa !5
  %67 = add nsw i32 %66, 1
  store i32 %67, ptr %7, align 4, !tbaa !5
  br label %42, !llvm.loop !11

68:                                               ; preds = %46
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #4
  store i32 1, ptr %12, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #4
  store i32 2, ptr %13, align 4, !tbaa !5
  br label %69

69:                                               ; preds = %88, %68
  %70 = load i32, ptr %13, align 4, !tbaa !5
  %71 = load i32, ptr @N, align 4, !tbaa !5
  %72 = add nsw i32 %71, 1
  %73 = icmp slt i32 %70, %72
  br i1 %73, label %75, label %74

74:                                               ; preds = %69
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  br label %91

75:                                               ; preds = %69
  %76 = load i32, ptr %13, align 4, !tbaa !5
  %77 = sext i32 %76 to i64
  %78 = getelementptr inbounds [10001 x i32], ptr @C, i64 0, i64 %77
  %79 = load i32, ptr %78, align 4, !tbaa !5
  %80 = load i32, ptr %12, align 4, !tbaa !5
  %81 = sext i32 %80 to i64
  %82 = getelementptr inbounds [10001 x i32], ptr @C, i64 0, i64 %81
  %83 = load i32, ptr %82, align 4, !tbaa !5
  %84 = icmp slt i32 %79, %83
  br i1 %84, label %85, label %87

85:                                               ; preds = %75
  %86 = load i32, ptr %13, align 4, !tbaa !5
  store i32 %86, ptr %12, align 4, !tbaa !5
  br label %87

87:                                               ; preds = %85, %75
  br label %88

88:                                               ; preds = %87
  %89 = load i32, ptr %13, align 4, !tbaa !5
  %90 = add nsw i32 %89, 1
  store i32 %90, ptr %13, align 4, !tbaa !5
  br label %69, !llvm.loop !12

91:                                               ; preds = %74
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #4
  call void @_ZNSt6vectorISt5arrayIiLm3EESaIS1_EEC2ERKS3_(ptr noundef nonnull align 8 dereferenceable(24) %15, ptr noundef nonnull align 8 dereferenceable(24) @v)
  %92 = invoke noundef i64 @_Z7kruskalSt6vectorISt5arrayIiLm3EESaIS1_EE(ptr noundef %15)
          to label %93 unwind label %102

93:                                               ; preds = %91
  call void @_ZNSt6vectorISt5arrayIiLm3EESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %15) #4
  store i64 %92, ptr %14, align 8, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #4
  %94 = load i64, ptr %14, align 8, !tbaa !13
  %95 = load i32, ptr %12, align 4, !tbaa !5
  %96 = sext i32 %95 to i64
  %97 = getelementptr inbounds [10001 x i32], ptr @C, i64 0, i64 %96
  %98 = load i32, ptr %97, align 4, !tbaa !5
  %99 = sext i32 %98 to i64
  %100 = add nsw i64 %94, %99
  store i64 %100, ptr %16, align 8, !tbaa !13
  call void @_ZN2io2prIxEEvRKT_(ptr noundef nonnull align 8 dereferenceable(8) %16)
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  %101 = load i32, ptr %1, align 4
  ret i32 %101

102:                                              ; preds = %91
  %103 = landingpad { ptr, i32 }
          cleanup
  %104 = extractvalue { ptr, i32 } %103, 0
  store ptr %104, ptr %4, align 8
  %105 = extractvalue { ptr, i32 } %103, 1
  store i32 %105, ptr %5, align 4
  call void @_ZNSt6vectorISt5arrayIiLm3EESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %15) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  br label %106

106:                                              ; preds = %102, %33
  %107 = load ptr, ptr %4, align 8
  %108 = load i32, ptr %5, align 4
  %109 = insertvalue { ptr, i32 } poison, ptr %107, 0
  %110 = insertvalue { ptr, i32 } %109, i32 %108, 1
  resume { ptr, i32 } %110
}

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef, ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #0 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN2io2reIiEEvRT_(ptr noundef nonnull align 4 dereferenceable(4)) #0

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN2io2prIxEEvRKT_(ptr noundef nonnull align 8 dereferenceable(8)) #0

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

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


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

%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<std::array<int, 3>, std::allocator<std::array<int, 3>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::array<int, 3>, std::allocator<std::array<int, 3>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::array<int, 3>, std::allocator<std::array<int, 3>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::array<int, 3>, std::allocator<std::array<int, 3>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%"class.std::allocator" = type { i8 }
%"struct.std::array" = type { [3 x i32] }

@N = external dso_local global i32, align 4
@P = external dso_local global i32, align 4
@C = external dso_local global [10001 x i32], align 16
@v = external dso_local global %"class.std::vector", align 8
@.str.6 = external hidden unnamed_addr constant [6 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN2io5setIOENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef) local_unnamed_addr #0

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #1 align 2

; 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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_Z7kruskalSt6vectorISt5arrayIiLm3EESaIS1_EE(ptr noundef) local_unnamed_addr #0

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #3 personality ptr @__gxx_personality_v0 {
  %1 = alloca %"class.std::__cxx11::basic_string", align 8
  %2 = alloca %"class.std::allocator", align 1
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca %"struct.std::array", align 4
  %7 = alloca %"class.std::vector", align 8
  %8 = alloca i64, align 8
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %2) #4
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %2) #4
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %1, ptr noundef nonnull @.str.6, ptr noundef nonnull align 1 dereferenceable(1) %2)
          to label %9 unwind label %17

9:                                                ; preds = %0
  invoke void @_ZN2io5setIOENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull %1)
          to label %10 unwind label %19

10:                                               ; preds = %9
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %1) #4
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %2) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %2) #4
  call void @_ZN2io2reIiJiEEEvRT_DpRT0_(ptr noundef nonnull align 4 dereferenceable(4) @N, ptr noundef nonnull align 4 dereferenceable(4) @P)
  %11 = load i32, ptr @N, align 4, !tbaa !5
  %.not26 = icmp slt i32 %11, 1
  br i1 %.not26, label %.preheader25, label %.lr.ph

.preheader25:                                     ; preds = %.lr.ph, %10
  %12 = phi i32 [ %11, %10 ], [ %23, %.lr.ph ]
  %13 = load i32, ptr @P, align 4, !tbaa !5
  %14 = icmp sgt i32 %13, 0
  br i1 %14, label %.lr.ph29, label %.preheader

.lr.ph29:                                         ; preds = %.preheader25
  %15 = getelementptr inbounds i8, ptr %6, i64 4
  %16 = getelementptr inbounds i8, ptr %6, i64 8
  br label %30

17:                                               ; preds = %0
  %18 = landingpad { ptr, i32 }
          cleanup
  br label %21

19:                                               ; preds = %9
  %20 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %1) #4
  br label %21

21:                                               ; preds = %19, %17
  %.pn = phi { ptr, i32 } [ %20, %19 ], [ %18, %17 ]
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %2) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %2) #4
  br label %90

.lr.ph:                                           ; preds = %10, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 1, %10 ]
  %22 = getelementptr inbounds [10001 x i32], ptr @C, i64 0, i64 %indvars.iv
  call void @_ZN2io2reIiEEvRT_(ptr noundef nonnull align 4 dereferenceable(4) %22)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %23 = load i32, ptr @N, align 4, !tbaa !5
  %24 = sext i32 %23 to i64
  %.not.not = icmp slt i64 %indvars.iv, %24
  br i1 %.not.not, label %.lr.ph, label %.preheader25, !llvm.loop !9

.preheader.loopexit:                              ; preds = %30
  %.pre = load i32, ptr @N, align 4, !tbaa !5
  br label %.preheader

.preheader:                                       ; preds = %.preheader.loopexit, %.preheader25
  %25 = phi i32 [ %.pre, %.preheader.loopexit ], [ %12, %.preheader25 ]
  %.not2230 = icmp slt i32 %25, 2
  br i1 %.not2230, label %._crit_edge, label %.lr.ph33.preheader

.lr.ph33.preheader:                               ; preds = %.preheader
  %26 = add nuw i32 %25, 1
  %wide.trip.count = zext i32 %26 to i64
  %27 = add nsw i64 %wide.trip.count, -2
  %28 = add nsw i64 %wide.trip.count, -3
  %xtraiter = and i64 %27, 3
  %29 = icmp ult i64 %28, 3
  br i1 %29, label %._crit_edge.loopexit.unr-lcssa, label %.lr.ph33.preheader.new

.lr.ph33.preheader.new:                           ; preds = %.lr.ph33.preheader
  %unroll_iter = and i64 %27, -4
  br label %.lr.ph33

30:                                               ; preds = %.lr.ph29, %30
  %.01728 = phi i32 [ 0, %.lr.ph29 ], [ %43, %30 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #4
  call void @_ZN2io2reIiJiiEEEvRT_DpRT0_(ptr noundef nonnull align 4 dereferenceable(4) %3, ptr noundef nonnull align 4 dereferenceable(4) %4, ptr noundef nonnull align 4 dereferenceable(4) %5)
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %6) #4
  %31 = load i32, ptr %5, align 4, !tbaa !5
  %32 = shl nsw i32 %31, 1
  %33 = load i32, ptr %3, align 4, !tbaa !5
  %34 = sext i32 %33 to i64
  %35 = getelementptr inbounds [10001 x i32], ptr @C, i64 0, i64 %34
  %36 = load i32, ptr %35, align 4, !tbaa !5
  %37 = add nsw i32 %36, %32
  %38 = load i32, ptr %4, align 4, !tbaa !5
  %39 = sext i32 %38 to i64
  %40 = getelementptr inbounds [10001 x i32], ptr @C, i64 0, i64 %39
  %41 = load i32, ptr %40, align 4, !tbaa !5
  %42 = add nsw i32 %37, %41
  store i32 %42, ptr %6, align 4, !tbaa !5
  store i32 %33, ptr %15, align 4, !tbaa !5
  store i32 %38, ptr %16, align 4, !tbaa !5
  call void @_ZNSt6vectorISt5arrayIiLm3EESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24) @v, ptr noundef nonnull align 4 dereferenceable(12) %6)
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %6) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #4
  %43 = add nuw nsw i32 %.01728, 1
  %44 = load i32, ptr @P, align 4, !tbaa !5
  %45 = icmp slt i32 %43, %44
  br i1 %45, label %30, label %.preheader.loopexit, !llvm.loop !11

._crit_edge.loopexit.unr-lcssa:                   ; preds = %.lr.ph33, %.lr.ph33.preheader
  %spec.select.lcssa.ph = phi i32 [ poison, %.lr.ph33.preheader ], [ %spec.select.3, %.lr.ph33 ]
  %indvars.iv35.unr = phi i64 [ 2, %.lr.ph33.preheader ], [ %indvars.iv.next36.3, %.lr.ph33 ]
  %.01531.unr = phi i32 [ 1, %.lr.ph33.preheader ], [ %spec.select.3, %.lr.ph33 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge.loopexit, label %.lr.ph33.epil

.lr.ph33.epil:                                    ; preds = %._crit_edge.loopexit.unr-lcssa, %.lr.ph33.epil
  %indvars.iv35.epil = phi i64 [ %indvars.iv.next36.epil, %.lr.ph33.epil ], [ %indvars.iv35.unr, %._crit_edge.loopexit.unr-lcssa ]
  %.01531.epil = phi i32 [ %spec.select.epil, %.lr.ph33.epil ], [ %.01531.unr, %._crit_edge.loopexit.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.lr.ph33.epil ], [ 0, %._crit_edge.loopexit.unr-lcssa ]
  %46 = getelementptr inbounds [10001 x i32], ptr @C, i64 0, i64 %indvars.iv35.epil
  %47 = load i32, ptr %46, align 4, !tbaa !5
  %48 = sext i32 %.01531.epil to i64
  %49 = getelementptr inbounds [10001 x i32], ptr @C, i64 0, i64 %48
  %50 = load i32, ptr %49, align 4, !tbaa !5
  %51 = icmp slt i32 %47, %50
  %52 = trunc nuw nsw i64 %indvars.iv35.epil to i32
  %spec.select.epil = select i1 %51, i32 %52, i32 %.01531.epil
  %indvars.iv.next36.epil = add nuw nsw i64 %indvars.iv35.epil, 1
  %epil.iter.next = add i64 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
  br i1 %epil.iter.cmp.not, label %._crit_edge.loopexit, label %.lr.ph33.epil, !llvm.loop !12

._crit_edge.loopexit:                             ; preds = %.lr.ph33.epil, %._crit_edge.loopexit.unr-lcssa
  %spec.select.lcssa = phi i32 [ %spec.select.lcssa.ph, %._crit_edge.loopexit.unr-lcssa ], [ %spec.select.epil, %.lr.ph33.epil ]
  %53 = sext i32 %spec.select.lcssa to i64
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %.preheader
  %.015.lcssa = phi i64 [ 1, %.preheader ], [ %53, %._crit_edge.loopexit ]
  call void @_ZNSt6vectorISt5arrayIiLm3EESaIS1_EEC2ERKS3_(ptr noundef nonnull align 8 dereferenceable(24) %7, ptr noundef nonnull align 8 dereferenceable(24) @v)
  %54 = invoke noundef i64 @_Z7kruskalSt6vectorISt5arrayIiLm3EESaIS1_EE(ptr noundef nonnull %7)
          to label %83 unwind label %88

.lr.ph33:                                         ; preds = %.lr.ph33, %.lr.ph33.preheader.new
  %indvars.iv35 = phi i64 [ 2, %.lr.ph33.preheader.new ], [ %indvars.iv.next36.3, %.lr.ph33 ]
  %.01531 = phi i32 [ 1, %.lr.ph33.preheader.new ], [ %spec.select.3, %.lr.ph33 ]
  %niter = phi i64 [ 0, %.lr.ph33.preheader.new ], [ %niter.next.3, %.lr.ph33 ]
  %55 = getelementptr inbounds [10001 x i32], ptr @C, i64 0, i64 %indvars.iv35
  %56 = load i32, ptr %55, align 8, !tbaa !5
  %57 = sext i32 %.01531 to i64
  %58 = getelementptr inbounds [10001 x i32], ptr @C, i64 0, i64 %57
  %59 = load i32, ptr %58, align 4, !tbaa !5
  %60 = icmp slt i32 %56, %59
  %61 = trunc nuw nsw i64 %indvars.iv35 to i32
  %spec.select = select i1 %60, i32 %61, i32 %.01531
  %indvars.iv.next36 = or disjoint i64 %indvars.iv35, 1
  %62 = getelementptr inbounds [10001 x i32], ptr @C, i64 0, i64 %indvars.iv.next36
  %63 = load i32, ptr %62, align 4, !tbaa !5
  %64 = sext i32 %spec.select to i64
  %65 = getelementptr inbounds [10001 x i32], ptr @C, i64 0, i64 %64
  %66 = load i32, ptr %65, align 4, !tbaa !5
  %67 = icmp slt i32 %63, %66
  %68 = trunc nuw nsw i64 %indvars.iv.next36 to i32
  %spec.select.1 = select i1 %67, i32 %68, i32 %spec.select
  %indvars.iv.next36.1 = add nuw nsw i64 %indvars.iv35, 2
  %69 = getelementptr inbounds [10001 x i32], ptr @C, i64 0, i64 %indvars.iv.next36.1
  %70 = load i32, ptr %69, align 8, !tbaa !5
  %71 = sext i32 %spec.select.1 to i64
  %72 = getelementptr inbounds [10001 x i32], ptr @C, i64 0, i64 %71
  %73 = load i32, ptr %72, align 4, !tbaa !5
  %74 = icmp slt i32 %70, %73
  %75 = trunc nuw nsw i64 %indvars.iv.next36.1 to i32
  %spec.select.2 = select i1 %74, i32 %75, i32 %spec.select.1
  %indvars.iv.next36.2 = add nuw nsw i64 %indvars.iv35, 3
  %76 = getelementptr inbounds [10001 x i32], ptr @C, i64 0, i64 %indvars.iv.next36.2
  %77 = load i32, ptr %76, align 4, !tbaa !5
  %78 = sext i32 %spec.select.2 to i64
  %79 = getelementptr inbounds [10001 x i32], ptr @C, i64 0, i64 %78
  %80 = load i32, ptr %79, align 4, !tbaa !5
  %81 = icmp slt i32 %77, %80
  %82 = trunc nuw nsw i64 %indvars.iv.next36.2 to i32
  %spec.select.3 = select i1 %81, i32 %82, i32 %spec.select.2
  %indvars.iv.next36.3 = add nuw nsw i64 %indvars.iv35, 4
  %niter.next.3 = add nuw i64 %niter, 4
  %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
  br i1 %niter.ncmp.3, label %._crit_edge.loopexit.unr-lcssa, label %.lr.ph33, !llvm.loop !14

83:                                               ; preds = %._crit_edge
  call void @_ZNSt6vectorISt5arrayIiLm3EESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %7) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #4
  %84 = getelementptr inbounds [10001 x i32], ptr @C, i64 0, i64 %.015.lcssa
  %85 = load i32, ptr %84, align 4, !tbaa !5
  %86 = sext i32 %85 to i64
  %87 = add nsw i64 %54, %86
  store i64 %87, ptr %8, align 8, !tbaa !15
  call void @_ZN2io2prIxEEvRKT_(ptr noundef nonnull align 8 dereferenceable(8) %8)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #4
  ret i32 0

88:                                               ; preds = %._crit_edge
  %89 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt6vectorISt5arrayIiLm3EESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %7) #4
  br label %90

90:                                               ; preds = %88, %21
  %.pn23 = phi { ptr, i32 } [ %89, %88 ], [ %.pn, %21 ]
  resume { ptr, i32 } %.pn23
}

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef, ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #0 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN2io2reIiEEvRT_(ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN2io2reIiJiiEEEvRT_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 #0

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

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

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

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

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


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