; LLVM IR from manishbisht/Competitive-Programming :: Algorithms/Graph Algorithms/KruskalMST.ll (Z10KruskalMSTP5Graph)

; 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::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 }
%class.Edge = type { i32, i32, i32 }
%class.Graph = type { i32, i32, ptr }
%class.subset = type { i32, i32 }

@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [48 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [5 x i8], align 1

; 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 speculatable willreturn memory(none)
declare { i64, i1 } @llvm.umul.with.overflow.i64(i64, i64) #1

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znam(i64 noundef) #2

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z4findP6subseti(ptr noundef, i32 noundef) #3

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z6myCompPKvS0_(ptr noundef, ptr noundef) #4

; Function Attrs: mustprogress uwtable
define dso_local void @_Z10KruskalMSTP5Graph(ptr noundef %0) #3 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca i64, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca %class.Edge, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #9
  %13 = load ptr, ptr %2, align 8, !tbaa !5
  %14 = getelementptr inbounds %class.Graph, ptr %13, i32 0, i32 0
  %15 = load i32, ptr %14, align 8, !tbaa !9
  store i32 %15, ptr %3, align 4, !tbaa !12
  %16 = load i32, ptr %3, align 4, !tbaa !12
  %17 = zext i32 %16 to i64
  %18 = call ptr @llvm.stacksave.p0()
  store ptr %18, ptr %4, align 8
  %19 = alloca %class.Edge, i64 %17, align 16
  store i64 %17, ptr %5, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #9
  store i32 0, ptr %6, align 4, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #9
  store i32 0, ptr %7, align 4, !tbaa !12
  %20 = load ptr, ptr %2, align 8, !tbaa !5
  %21 = getelementptr inbounds %class.Graph, ptr %20, i32 0, i32 2
  %22 = load ptr, ptr %21, align 8, !tbaa !13
  %23 = load ptr, ptr %2, align 8, !tbaa !5
  %24 = getelementptr inbounds %class.Graph, ptr %23, i32 0, i32 1
  %25 = load i32, ptr %24, align 4, !tbaa !14
  %26 = sext i32 %25 to i64
  call void @qsort(ptr noundef %22, i64 noundef %26, i64 noundef 12, ptr noundef @_Z6myCompPKvS0_)
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #9
  %27 = load i32, ptr %3, align 4, !tbaa !12
  %28 = sext i32 %27 to i64
  %29 = mul i64 %28, 8
  %30 = call { i64, i1 } @llvm.umul.with.overflow.i64(i64 %29, i64 8)
  %31 = extractvalue { i64, i1 } %30, 1
  %32 = extractvalue { i64, i1 } %30, 0
  %33 = select i1 %31, i64 -1, i64 %32
  %34 = call noalias noundef nonnull ptr @_Znam(i64 noundef %33) #10
  store ptr %34, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #9
  store i32 0, ptr %9, align 4, !tbaa !12
  br label %35

35:                                               ; preds = %52, %1
  %36 = load i32, ptr %9, align 4, !tbaa !12
  %37 = load i32, ptr %3, align 4, !tbaa !12
  %38 = icmp slt i32 %36, %37
  br i1 %38, label %40, label %39

39:                                               ; preds = %35
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #9
  br label %55

40:                                               ; preds = %35
  %41 = load i32, ptr %9, align 4, !tbaa !12
  %42 = load ptr, ptr %8, align 8, !tbaa !5
  %43 = load i32, ptr %9, align 4, !tbaa !12
  %44 = sext i32 %43 to i64
  %45 = getelementptr inbounds %class.subset, ptr %42, i64 %44
  %46 = getelementptr inbounds %class.subset, ptr %45, i32 0, i32 0
  store i32 %41, ptr %46, align 4, !tbaa !15
  %47 = load ptr, ptr %8, align 8, !tbaa !5
  %48 = load i32, ptr %9, align 4, !tbaa !12
  %49 = sext i32 %48 to i64
  %50 = getelementptr inbounds %class.subset, ptr %47, i64 %49
  %51 = getelementptr inbounds %class.subset, ptr %50, i32 0, i32 1
  store i32 0, ptr %51, align 4, !tbaa !17
  br label %52

52:                                               ; preds = %40
  %53 = load i32, ptr %9, align 4, !tbaa !12
  %54 = add nsw i32 %53, 1
  store i32 %54, ptr %9, align 4, !tbaa !12
  br label %35, !llvm.loop !18

55:                                               ; preds = %39
  br label %56

56:                                               ; preds = %96, %55
  %57 = load i32, ptr %6, align 4, !tbaa !12
  %58 = load i32, ptr %3, align 4, !tbaa !12
  %59 = sub nsw i32 %58, 1
  %60 = icmp slt i32 %57, %59
  br i1 %60, label %61, label %67

61:                                               ; preds = %56
  %62 = load i32, ptr %7, align 4, !tbaa !12
  %63 = load ptr, ptr %2, align 8, !tbaa !5
  %64 = getelementptr inbounds %class.Graph, ptr %63, i32 0, i32 1
  %65 = load i32, ptr %64, align 4, !tbaa !14
  %66 = icmp slt i32 %62, %65
  br label %67

67:                                               ; preds = %61, %56
  %68 = phi i1 [ false, %56 ], [ %66, %61 ]
  br i1 %68, label %69, label %97

69:                                               ; preds = %67
  call void @llvm.lifetime.start.p0(i64 12, ptr %10) #9
  %70 = load ptr, ptr %2, align 8, !tbaa !5
  %71 = getelementptr inbounds %class.Graph, ptr %70, i32 0, i32 2
  %72 = load ptr, ptr %71, align 8, !tbaa !13
  %73 = load i32, ptr %7, align 4, !tbaa !12
  %74 = add nsw i32 %73, 1
  store i32 %74, ptr %7, align 4, !tbaa !12
  %75 = sext i32 %73 to i64
  %76 = getelementptr inbounds %class.Edge, ptr %72, i64 %75
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %10, ptr align 4 %76, i64 12, i1 false), !tbaa.struct !20
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #9
  %77 = load ptr, ptr %8, align 8, !tbaa !5
  %78 = getelementptr inbounds %class.Edge, ptr %10, i32 0, i32 0
  %79 = load i32, ptr %78, align 4, !tbaa !21
  %80 = call noundef i32 @_Z4findP6subseti(ptr noundef %77, i32 noundef %79)
  store i32 %80, ptr %11, align 4, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #9
  %81 = load ptr, ptr %8, align 8, !tbaa !5
  %82 = getelementptr inbounds %class.Edge, ptr %10, i32 0, i32 1
  %83 = load i32, ptr %82, align 4, !tbaa !23
  %84 = call noundef i32 @_Z4findP6subseti(ptr noundef %81, i32 noundef %83)
  store i32 %84, ptr %12, align 4, !tbaa !12
  %85 = load i32, ptr %11, align 4, !tbaa !12
  %86 = load i32, ptr %12, align 4, !tbaa !12
  %87 = icmp ne i32 %85, %86
  br i1 %87, label %88, label %96

88:                                               ; preds = %69
  %89 = load i32, ptr %6, align 4, !tbaa !12
  %90 = add nsw i32 %89, 1
  store i32 %90, ptr %6, align 4, !tbaa !12
  %91 = sext i32 %89 to i64
  %92 = getelementptr inbounds %class.Edge, ptr %19, i64 %91
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %92, ptr align 4 %10, i64 12, i1 false), !tbaa.struct !20
  %93 = load ptr, ptr %8, align 8, !tbaa !5
  %94 = load i32, ptr %11, align 4, !tbaa !12
  %95 = load i32, ptr %12, align 4, !tbaa !12
  call void @_Z5UnionP6subsetii(ptr noundef %93, i32 noundef %94, i32 noundef %95)
  br label %96

96:                                               ; preds = %88, %69
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #9
  call void @llvm.lifetime.end.p0(i64 12, ptr %10) #9
  br label %56, !llvm.loop !24

97:                                               ; preds = %67
  %98 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str)
  store i32 0, ptr %7, align 4, !tbaa !12
  br label %99

99:                                               ; preds = %125, %97
  %100 = load i32, ptr %7, align 4, !tbaa !12
  %101 = load i32, ptr %6, align 4, !tbaa !12
  %102 = icmp slt i32 %100, %101
  br i1 %102, label %103, label %128

103:                                              ; preds = %99
  %104 = load i32, ptr %7, align 4, !tbaa !12
  %105 = sext i32 %104 to i64
  %106 = getelementptr inbounds %class.Edge, ptr %19, i64 %105
  %107 = getelementptr inbounds %class.Edge, ptr %106, i32 0, i32 0
  %108 = load i32, ptr %107, align 4, !tbaa !21
  %109 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %108)
  %110 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %109, ptr noundef @.str.1)
  %111 = load i32, ptr %7, align 4, !tbaa !12
  %112 = sext i32 %111 to i64
  %113 = getelementptr inbounds %class.Edge, ptr %19, i64 %112
  %114 = getelementptr inbounds %class.Edge, ptr %113, i32 0, i32 1
  %115 = load i32, ptr %114, align 4, !tbaa !23
  %116 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %110, i32 noundef %115)
  %117 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %116, ptr noundef @.str.2)
  %118 = load i32, ptr %7, align 4, !tbaa !12
  %119 = sext i32 %118 to i64
  %120 = getelementptr inbounds %class.Edge, ptr %19, i64 %119
  %121 = getelementptr inbounds %class.Edge, ptr %120, i32 0, i32 2
  %122 = load i32, ptr %121, align 4, !tbaa !25
  %123 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %117, i32 noundef %122)
  %124 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %123, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  br label %125

125:                                              ; preds = %103
  %126 = load i32, ptr %7, align 4, !tbaa !12
  %127 = add nsw i32 %126, 1
  store i32 %127, ptr %7, align 4, !tbaa !12
  br label %99, !llvm.loop !26

128:                                              ; preds = %99
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #9
  %129 = load ptr, ptr %4, align 8
  call void @llvm.stackrestore.p0(ptr %129)
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #9
  ret void
}

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #5

declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr noundef) #6

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #7

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #8

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) #6

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #3 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #8

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #5

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

!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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !11, i64 0}
!10 = !{!"_ZTS5Graph", !11, i64 0, !11, i64 4, !6, i64 8}
!11 = !{!"int", !7, i64 0}
!12 = !{!11, !11, i64 0}
!13 = !{!10, !6, i64 8}
!14 = !{!10, !11, i64 4}
!15 = !{!16, !11, i64 0}
!16 = !{!"_ZTS6subset", !11, i64 0, !11, i64 4}
!17 = !{!16, !11, i64 4}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.mustprogress"}
!20 = !{i64 0, i64 4, !12, i64 4, i64 4, !12, i64 8, i64 4, !12}
!21 = !{!22, !11, i64 0}
!22 = !{!"_ZTS4Edge", !11, i64 0, !11, i64 4, !11, i64 8}
!23 = !{!22, !11, i64 4}
!24 = distinct !{!24, !19}
!25 = !{!22, !11, i64 8}
!26 = distinct !{!26, !19}


; 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::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 }
%class.Edge = type { i32, i32, i32 }
%class.subset = type { i32, i32 }

@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [48 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [5 x i8], align 1

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znam(i64 noundef) local_unnamed_addr #0

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z6myCompPKvS0_(ptr noundef, ptr noundef) #2

; Function Attrs: mustprogress uwtable
define dso_local void @_Z10KruskalMSTP5Graph(ptr nocapture noundef readonly %0) local_unnamed_addr #1 {
  %2 = load i32, ptr %0, align 8, !tbaa !5
  %3 = zext i32 %2 to i64
  %4 = alloca %class.Edge, i64 %3, align 16
  %5 = getelementptr inbounds i8, ptr %0, i64 8
  %6 = load ptr, ptr %5, align 8, !tbaa !11
  %7 = getelementptr inbounds i8, ptr %0, i64 4
  %8 = load i32, ptr %7, align 4, !tbaa !12
  %9 = sext i32 %8 to i64
  tail call void @qsort(ptr noundef %6, i64 noundef %9, i64 noundef 12, ptr noundef nonnull @_Z6myCompPKvS0_)
  %10 = sext i32 %2 to i64
  %11 = icmp slt i32 %2, 0
  %12 = shl nsw i64 %10, 6
  %13 = select i1 %11, i64 -1, i64 %12
  %14 = tail call noalias noundef nonnull ptr @_Znam(i64 noundef %13) #6
  %15 = icmp sgt i32 %2, 0
  br i1 %15, label %.lr.ph.preheader, label %.critedge.thread

.lr.ph.preheader:                                 ; preds = %1
  %min.iters.check = icmp ult i32 %2, 4
  br i1 %min.iters.check, label %.lr.ph.preheader65, label %vector.ph

.lr.ph.preheader65:                               ; preds = %middle.block, %.lr.ph.preheader
  %indvars.iv.ph = phi i64 [ 0, %.lr.ph.preheader ], [ %n.vec, %middle.block ]
  br label %.lr.ph

vector.ph:                                        ; preds = %.lr.ph.preheader
  %n.vec = and i64 %3, 2147483644
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %vec.ind = phi <2 x i32> [ <i32 0, i32 1>, %vector.ph ], [ %vec.ind.next, %vector.body ]
  %step.add = add <2 x i32> %vec.ind, <i32 2, i32 2>
  %16 = or disjoint i64 %index, 2
  %17 = getelementptr inbounds %class.subset, ptr %14, i64 %index
  %18 = getelementptr inbounds %class.subset, ptr %14, i64 %16
  %interleaved.vec = shufflevector <2 x i32> %vec.ind, <2 x i32> zeroinitializer, <4 x i32> <i32 0, i32 2, i32 1, i32 3>
  store <4 x i32> %interleaved.vec, ptr %17, align 4, !tbaa !13
  %interleaved.vec64 = shufflevector <2 x i32> %step.add, <2 x i32> zeroinitializer, <4 x i32> <i32 0, i32 2, i32 1, i32 3>
  store <4 x i32> %interleaved.vec64, ptr %18, align 4, !tbaa !13
  %index.next = add nuw i64 %index, 4
  %vec.ind.next = add <2 x i32> %vec.ind, <i32 4, i32 4>
  %19 = icmp eq i64 %index.next, %n.vec
  br i1 %19, label %middle.block, label %vector.body, !llvm.loop !14

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %n.vec, %3
  br i1 %cmp.n, label %.preheader, label %.lr.ph.preheader65

.preheader:                                       ; preds = %.lr.ph, %middle.block
  %20 = add nsw i32 %2, -1
  %.not62 = icmp eq i32 %2, 1
  br i1 %.not62, label %.critedge.thread, label %.lr.ph47

.lr.ph:                                           ; preds = %.lr.ph.preheader65, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ %indvars.iv.ph, %.lr.ph.preheader65 ]
  %21 = getelementptr inbounds %class.subset, ptr %14, i64 %indvars.iv
  %22 = trunc nuw nsw i64 %indvars.iv to i32
  store i32 %22, ptr %21, align 4, !tbaa !18
  %23 = getelementptr inbounds i8, ptr %21, i64 4
  store i32 0, ptr %23, align 4, !tbaa !20
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %3
  br i1 %exitcond.not, label %.preheader, label %.lr.ph, !llvm.loop !21

.lr.ph47:                                         ; preds = %.preheader, %38
  %indvars.iv53 = phi i64 [ %indvars.iv.next54, %38 ], [ 0, %.preheader ]
  %.046 = phi i32 [ %.1, %38 ], [ 0, %.preheader ]
  %24 = load i32, ptr %7, align 4, !tbaa !12
  %25 = sext i32 %24 to i64
  %26 = icmp slt i64 %indvars.iv53, %25
  br i1 %26, label %27, label %.critedge

27:                                               ; preds = %.lr.ph47
  %28 = load ptr, ptr %5, align 8, !tbaa !11
  %indvars.iv.next54 = add nuw nsw i64 %indvars.iv53, 1
  %29 = getelementptr inbounds %class.Edge, ptr %28, i64 %indvars.iv53
  %.sroa.0.0.copyload = load i32, ptr %29, align 4, !tbaa !13
  %.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %29, i64 4
  %30 = load <2 x i32>, ptr %.sroa.5.0..sroa_idx, align 4, !tbaa !13
  %31 = tail call noundef i32 @_Z4findP6subseti(ptr noundef nonnull %14, i32 noundef %.sroa.0.0.copyload)
  %32 = extractelement <2 x i32> %30, i64 0
  %33 = tail call noundef i32 @_Z4findP6subseti(ptr noundef nonnull %14, i32 noundef %32)
  %.not = icmp eq i32 %31, %33
  br i1 %.not, label %38, label %34

34:                                               ; preds = %27
  %35 = add nsw i32 %.046, 1
  %36 = sext i32 %.046 to i64
  %37 = getelementptr inbounds %class.Edge, ptr %4, i64 %36
  store i32 %.sroa.0.0.copyload, ptr %37, align 4, !tbaa !13
  %.sroa.5.0..sroa_idx5 = getelementptr inbounds i8, ptr %37, i64 4
  store <2 x i32> %30, ptr %.sroa.5.0..sroa_idx5, align 4, !tbaa !13
  tail call void @_Z5UnionP6subsetii(ptr noundef nonnull %14, i32 noundef %31, i32 noundef %33)
  br label %38

38:                                               ; preds = %34, %27
  %.1 = phi i32 [ %35, %34 ], [ %.046, %27 ]
  %39 = icmp slt i32 %.1, %20
  br i1 %39, label %.lr.ph47, label %.critedge, !llvm.loop !22

.critedge.thread:                                 ; preds = %.preheader, %1
  %40 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull @.str)
  br label %._crit_edge

.critedge:                                        ; preds = %.lr.ph47, %38
  %.0.lcssa = phi i32 [ %.046, %.lr.ph47 ], [ %.1, %38 ]
  %41 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull @.str)
  %42 = icmp sgt i32 %.0.lcssa, 0
  br i1 %42, label %.lr.ph51.preheader, label %._crit_edge

.lr.ph51.preheader:                               ; preds = %.critedge
  %wide.trip.count59 = zext nneg i32 %.0.lcssa to i64
  br label %.lr.ph51

.lr.ph51:                                         ; preds = %.lr.ph51.preheader, %.lr.ph51
  %indvars.iv56 = phi i64 [ 0, %.lr.ph51.preheader ], [ %indvars.iv.next57, %.lr.ph51 ]
  %43 = getelementptr inbounds %class.Edge, ptr %4, i64 %indvars.iv56
  %44 = load i32, ptr %43, align 4, !tbaa !23
  %45 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %44)
  %46 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %45, ptr noundef nonnull @.str.1)
  %47 = getelementptr inbounds i8, ptr %43, i64 4
  %48 = load i32, ptr %47, align 4, !tbaa !25
  %49 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %46, i32 noundef %48)
  %50 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %49, ptr noundef nonnull @.str.2)
  %51 = getelementptr inbounds i8, ptr %43, i64 8
  %52 = load i32, ptr %51, align 4, !tbaa !26
  %53 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %50, i32 noundef %52)
  %54 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %53, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  %indvars.iv.next57 = add nuw nsw i64 %indvars.iv56, 1
  %exitcond60.not = icmp eq i64 %indvars.iv.next57, %wide.trip.count59
  br i1 %exitcond60.not, label %._crit_edge, label %.lr.ph51, !llvm.loop !27

._crit_edge:                                      ; preds = %.lr.ph51, %.critedge.thread, %.critedge
  ret void
}

; Function Attrs: nofree
declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #3

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

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) local_unnamed_addr #5

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

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #4

attributes #0 = { nobuiltin allocsize(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 nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree "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 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { builtin allocsize(0) }

!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, !7, i64 0}
!6 = !{!"_ZTS5Graph", !7, i64 0, !7, i64 4, !10, i64 8}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!6, !10, i64 8}
!12 = !{!6, !7, i64 4}
!13 = !{!7, !7, i64 0}
!14 = distinct !{!14, !15, !16, !17}
!15 = !{!"llvm.loop.mustprogress"}
!16 = !{!"llvm.loop.isvectorized", i32 1}
!17 = !{!"llvm.loop.unroll.runtime.disable"}
!18 = !{!19, !7, i64 0}
!19 = !{!"_ZTS6subset", !7, i64 0, !7, i64 4}
!20 = !{!19, !7, i64 4}
!21 = distinct !{!21, !15, !17, !16}
!22 = distinct !{!22, !15}
!23 = !{!24, !7, i64 0}
!24 = !{!"_ZTS4Edge", !7, i64 0, !7, i64 4, !7, i64 8}
!25 = !{!24, !7, i64 4}
!26 = !{!24, !7, i64 8}
!27 = distinct !{!27, !15}


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