; LLVM IR from Dev-XYS/Algorithms :: Biconnected-Component.ll (Z3DFSii)

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

%struct.vertex = type { i32, i32, i32 }
%struct.edge = type { i32, i32, i32 }

@V = external dso_local global [100000 x %struct.vertex], align 16
@E = external dso_local global [100000 x %struct.edge], align 16
@dfn = external dso_local global i32, align 4
@col = external dso_local global i32, align 4

; Function Attrs: mustprogress uwtable
define dso_local void @_Z3DFSii(i32 noundef %0, i32 noundef %1) #0 {
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  store i32 %0, ptr %3, align 4, !tbaa !5
  store i32 %1, ptr %4, align 4, !tbaa !5
  %7 = load i32, ptr @dfn, align 4, !tbaa !5
  %8 = add nsw i32 %7, 1
  store i32 %8, ptr @dfn, align 4, !tbaa !5
  %9 = load i32, ptr %3, align 4, !tbaa !5
  %10 = sext i32 %9 to i64
  %11 = getelementptr inbounds [100000 x %struct.vertex], ptr @V, i64 0, i64 %10
  %12 = getelementptr inbounds %struct.vertex, ptr %11, i32 0, i32 2
  store i32 %7, ptr %12, align 4, !tbaa !9
  %13 = load i32, ptr %3, align 4, !tbaa !5
  %14 = sext i32 %13 to i64
  %15 = getelementptr inbounds [100000 x %struct.vertex], ptr @V, i64 0, i64 %14
  %16 = getelementptr inbounds %struct.vertex, ptr %15, i32 0, i32 1
  store i32 %7, ptr %16, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #3
  %17 = load i32, ptr %3, align 4, !tbaa !5
  %18 = sext i32 %17 to i64
  %19 = getelementptr inbounds [100000 x %struct.vertex], ptr @V, i64 0, i64 %18
  %20 = getelementptr inbounds %struct.vertex, ptr %19, i32 0, i32 0
  %21 = load i32, ptr %20, align 4, !tbaa !12
  store i32 %21, ptr %5, align 4, !tbaa !5
  br label %22

22:                                               ; preds = %132, %2
  %23 = load i32, ptr %5, align 4, !tbaa !5
  %24 = icmp ne i32 %23, 0
  br i1 %24, label %26, label %25

25:                                               ; preds = %22
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #3
  br label %138

26:                                               ; preds = %22
  %27 = load i32, ptr %5, align 4, !tbaa !5
  %28 = sext i32 %27 to i64
  %29 = getelementptr inbounds [100000 x %struct.edge], ptr @E, i64 0, i64 %28
  %30 = getelementptr inbounds %struct.edge, ptr %29, i32 0, i32 0
  %31 = load i32, ptr %30, align 4, !tbaa !13
  %32 = sext i32 %31 to i64
  %33 = getelementptr inbounds [100000 x %struct.vertex], ptr @V, i64 0, i64 %32
  %34 = getelementptr inbounds %struct.vertex, ptr %33, i32 0, i32 1
  %35 = load i32, ptr %34, align 4, !tbaa !11
  %36 = icmp eq i32 %35, 0
  br i1 %36, label %37, label %101

37:                                               ; preds = %26
  %38 = load i32, ptr %5, align 4, !tbaa !5
  call void @_Z4pushi(i32 noundef %38)
  %39 = load i32, ptr %5, align 4, !tbaa !5
  %40 = sext i32 %39 to i64
  %41 = getelementptr inbounds [100000 x %struct.edge], ptr @E, i64 0, i64 %40
  %42 = getelementptr inbounds %struct.edge, ptr %41, i32 0, i32 0
  %43 = load i32, ptr %42, align 4, !tbaa !13
  %44 = load i32, ptr %3, align 4, !tbaa !5
  call void @_Z3DFSii(i32 noundef %43, i32 noundef %44)
  %45 = load i32, ptr %3, align 4, !tbaa !5
  %46 = sext i32 %45 to i64
  %47 = getelementptr inbounds [100000 x %struct.vertex], ptr @V, i64 0, i64 %46
  %48 = getelementptr inbounds %struct.vertex, ptr %47, i32 0, i32 2
  %49 = load i32, ptr %48, align 4, !tbaa !9
  %50 = load i32, ptr %5, align 4, !tbaa !5
  %51 = sext i32 %50 to i64
  %52 = getelementptr inbounds [100000 x %struct.edge], ptr @E, i64 0, i64 %51
  %53 = getelementptr inbounds %struct.edge, ptr %52, i32 0, i32 0
  %54 = load i32, ptr %53, align 4, !tbaa !13
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds [100000 x %struct.vertex], ptr @V, i64 0, i64 %55
  %57 = getelementptr inbounds %struct.vertex, ptr %56, i32 0, i32 2
  %58 = load i32, ptr %57, align 4, !tbaa !9
  %59 = call noundef i32 @_Z3minii(i32 noundef %49, i32 noundef %58)
  %60 = load i32, ptr %3, align 4, !tbaa !5
  %61 = sext i32 %60 to i64
  %62 = getelementptr inbounds [100000 x %struct.vertex], ptr @V, i64 0, i64 %61
  %63 = getelementptr inbounds %struct.vertex, ptr %62, i32 0, i32 2
  store i32 %59, ptr %63, align 4, !tbaa !9
  %64 = load i32, ptr %5, align 4, !tbaa !5
  %65 = sext i32 %64 to i64
  %66 = getelementptr inbounds [100000 x %struct.edge], ptr @E, i64 0, i64 %65
  %67 = getelementptr inbounds %struct.edge, ptr %66, i32 0, i32 0
  %68 = load i32, ptr %67, align 4, !tbaa !13
  %69 = sext i32 %68 to i64
  %70 = getelementptr inbounds [100000 x %struct.vertex], ptr @V, i64 0, i64 %69
  %71 = getelementptr inbounds %struct.vertex, ptr %70, i32 0, i32 2
  %72 = load i32, ptr %71, align 4, !tbaa !9
  %73 = load i32, ptr %3, align 4, !tbaa !5
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds [100000 x %struct.vertex], ptr @V, i64 0, i64 %74
  %76 = getelementptr inbounds %struct.vertex, ptr %75, i32 0, i32 1
  %77 = load i32, ptr %76, align 4, !tbaa !11
  %78 = icmp sge i32 %72, %77
  br i1 %78, label %79, label %100

79:                                               ; preds = %37
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #3
  br label %80

80:                                               ; preds = %93, %79
  %81 = call noundef i32 @_Z3popv()
  store i32 %81, ptr %6, align 4, !tbaa !5
  %82 = load i32, ptr @col, align 4, !tbaa !5
  %83 = load i32, ptr %6, align 4, !tbaa !5
  %84 = sext i32 %83 to i64
  %85 = getelementptr inbounds [100000 x %struct.edge], ptr @E, i64 0, i64 %84
  %86 = getelementptr inbounds %struct.edge, ptr %85, i32 0, i32 2
  store i32 %82, ptr %86, align 4, !tbaa !15
  %87 = load i32, ptr @col, align 4, !tbaa !5
  %88 = load i32, ptr %6, align 4, !tbaa !5
  %89 = xor i32 %88, 1
  %90 = sext i32 %89 to i64
  %91 = getelementptr inbounds [100000 x %struct.edge], ptr @E, i64 0, i64 %90
  %92 = getelementptr inbounds %struct.edge, ptr %91, i32 0, i32 2
  store i32 %87, ptr %92, align 4, !tbaa !15
  br label %93

93:                                               ; preds = %80
  %94 = load i32, ptr %6, align 4, !tbaa !5
  %95 = load i32, ptr %5, align 4, !tbaa !5
  %96 = icmp ne i32 %94, %95
  br i1 %96, label %80, label %97, !llvm.loop !16

97:                                               ; preds = %93
  %98 = load i32, ptr @col, align 4, !tbaa !5
  %99 = add nsw i32 %98, 1
  store i32 %99, ptr @col, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #3
  br label %100

100:                                              ; preds = %97, %37
  br label %131

101:                                              ; preds = %26
  %102 = load i32, ptr %5, align 4, !tbaa !5
  %103 = sext i32 %102 to i64
  %104 = getelementptr inbounds [100000 x %struct.edge], ptr @E, i64 0, i64 %103
  %105 = getelementptr inbounds %struct.edge, ptr %104, i32 0, i32 0
  %106 = load i32, ptr %105, align 4, !tbaa !13
  %107 = load i32, ptr %4, align 4, !tbaa !5
  %108 = icmp ne i32 %106, %107
  br i1 %108, label %109, label %130

109:                                              ; preds = %101
  %110 = load i32, ptr %5, align 4, !tbaa !5
  call void @_Z4pushi(i32 noundef %110)
  %111 = load i32, ptr %3, align 4, !tbaa !5
  %112 = sext i32 %111 to i64
  %113 = getelementptr inbounds [100000 x %struct.vertex], ptr @V, i64 0, i64 %112
  %114 = getelementptr inbounds %struct.vertex, ptr %113, i32 0, i32 2
  %115 = load i32, ptr %114, align 4, !tbaa !9
  %116 = load i32, ptr %5, align 4, !tbaa !5
  %117 = sext i32 %116 to i64
  %118 = getelementptr inbounds [100000 x %struct.edge], ptr @E, i64 0, i64 %117
  %119 = getelementptr inbounds %struct.edge, ptr %118, i32 0, i32 0
  %120 = load i32, ptr %119, align 4, !tbaa !13
  %121 = sext i32 %120 to i64
  %122 = getelementptr inbounds [100000 x %struct.vertex], ptr @V, i64 0, i64 %121
  %123 = getelementptr inbounds %struct.vertex, ptr %122, i32 0, i32 1
  %124 = load i32, ptr %123, align 4, !tbaa !11
  %125 = call noundef i32 @_Z3minii(i32 noundef %115, i32 noundef %124)
  %126 = load i32, ptr %3, align 4, !tbaa !5
  %127 = sext i32 %126 to i64
  %128 = getelementptr inbounds [100000 x %struct.vertex], ptr @V, i64 0, i64 %127
  %129 = getelementptr inbounds %struct.vertex, ptr %128, i32 0, i32 2
  store i32 %125, ptr %129, align 4, !tbaa !9
  br label %130

130:                                              ; preds = %109, %101
  br label %131

131:                                              ; preds = %130, %100
  br label %132

132:                                              ; preds = %131
  %133 = load i32, ptr %5, align 4, !tbaa !5
  %134 = sext i32 %133 to i64
  %135 = getelementptr inbounds [100000 x %struct.edge], ptr @E, i64 0, i64 %134
  %136 = getelementptr inbounds %struct.edge, ptr %135, i32 0, i32 1
  %137 = load i32, ptr %136, align 4, !tbaa !18
  store i32 %137, ptr %5, align 4, !tbaa !5
  br label %22, !llvm.loop !19

138:                                              ; preds = %25
  ret void
}

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z3popv() #2

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

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

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

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


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

%struct.vertex = type { i32, i32, i32 }
%struct.edge = type { i32, i32, i32 }

@V = external dso_local local_unnamed_addr global [100000 x %struct.vertex], align 16
@E = external dso_local local_unnamed_addr global [100000 x %struct.edge], align 16
@dfn = external dso_local local_unnamed_addr global i32, align 4
@col = external dso_local local_unnamed_addr global i32, align 4

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_Z3DFSii(i32 noundef %0, i32 noundef %1) local_unnamed_addr #0 {
  %3 = load i32, ptr @dfn, align 4, !tbaa !5
  %4 = add nsw i32 %3, 1
  store i32 %4, ptr @dfn, align 4, !tbaa !5
  %5 = sext i32 %0 to i64
  %6 = getelementptr inbounds [100000 x %struct.vertex], ptr @V, i64 0, i64 %5
  %7 = getelementptr inbounds i8, ptr %6, i64 8
  store i32 %3, ptr %7, align 4, !tbaa !9
  %8 = getelementptr inbounds i8, ptr %6, i64 4
  store i32 %3, ptr %8, align 4, !tbaa !11
  %.027 = load i32, ptr %6, align 4, !tbaa !5
  %.not28 = icmp eq i32 %.027, 0
  br i1 %.not28, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %46, %2
  ret void

.lr.ph:                                           ; preds = %2, %46
  %.029 = phi i32 [ %.0, %46 ], [ %.027, %2 ]
  %9 = sext i32 %.029 to i64
  %10 = getelementptr inbounds [100000 x %struct.edge], ptr @E, i64 0, i64 %9
  %11 = load i32, ptr %10, align 4, !tbaa !12
  %12 = sext i32 %11 to i64
  %13 = getelementptr inbounds [100000 x %struct.vertex], ptr @V, i64 0, i64 %12, i32 1
  %14 = load i32, ptr %13, align 4, !tbaa !11
  %15 = icmp eq i32 %14, 0
  br i1 %15, label %16, label %38

16:                                               ; preds = %.lr.ph
  tail call void @_Z4pushi(i32 noundef %.029)
  %17 = load i32, ptr %10, align 4, !tbaa !12
  tail call void @_Z3DFSii(i32 noundef %17, i32 noundef %0)
  %18 = load i32, ptr %7, align 4, !tbaa !9
  %19 = load i32, ptr %10, align 4, !tbaa !12
  %20 = sext i32 %19 to i64
  %21 = getelementptr inbounds [100000 x %struct.vertex], ptr @V, i64 0, i64 %20, i32 2
  %22 = load i32, ptr %21, align 4, !tbaa !9
  %23 = tail call noundef i32 @_Z3minii(i32 noundef %18, i32 noundef %22)
  store i32 %23, ptr %7, align 4, !tbaa !9
  %24 = load i32, ptr %10, align 4, !tbaa !12
  %25 = sext i32 %24 to i64
  %26 = getelementptr inbounds [100000 x %struct.vertex], ptr @V, i64 0, i64 %25, i32 2
  %27 = load i32, ptr %26, align 4, !tbaa !9
  %28 = load i32, ptr %8, align 4, !tbaa !11
  %.not25 = icmp slt i32 %27, %28
  br i1 %.not25, label %46, label %.preheader

.preheader:                                       ; preds = %16, %.preheader
  %29 = tail call noundef i32 @_Z3popv()
  %30 = load i32, ptr @col, align 4, !tbaa !5
  %31 = sext i32 %29 to i64
  %32 = getelementptr inbounds [100000 x %struct.edge], ptr @E, i64 0, i64 %31, i32 2
  store i32 %30, ptr %32, align 4, !tbaa !14
  %33 = xor i32 %29, 1
  %34 = sext i32 %33 to i64
  %35 = getelementptr inbounds [100000 x %struct.edge], ptr @E, i64 0, i64 %34, i32 2
  store i32 %30, ptr %35, align 4, !tbaa !14
  %.not26 = icmp eq i32 %29, %.029
  br i1 %.not26, label %36, label %.preheader, !llvm.loop !15

36:                                               ; preds = %.preheader
  %37 = add nsw i32 %30, 1
  store i32 %37, ptr @col, align 4, !tbaa !5
  br label %46

38:                                               ; preds = %.lr.ph
  %.not24 = icmp eq i32 %11, %1
  br i1 %.not24, label %46, label %39

39:                                               ; preds = %38
  tail call void @_Z4pushi(i32 noundef %.029)
  %40 = load i32, ptr %7, align 4, !tbaa !9
  %41 = load i32, ptr %10, align 4, !tbaa !12
  %42 = sext i32 %41 to i64
  %43 = getelementptr inbounds [100000 x %struct.vertex], ptr @V, i64 0, i64 %42, i32 1
  %44 = load i32, ptr %43, align 4, !tbaa !11
  %45 = tail call noundef i32 @_Z3minii(i32 noundef %40, i32 noundef %44)
  store i32 %45, ptr %7, align 4, !tbaa !9
  br label %46

46:                                               ; preds = %36, %16, %39, %38
  %47 = getelementptr inbounds i8, ptr %10, i64 4
  %.0 = load i32, ptr %47, align 4, !tbaa !5
  %.not = icmp eq i32 %.0, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph, !llvm.loop !17
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_Z4pushi(i32 noundef) local_unnamed_addr #1

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

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

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 = { 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" }

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

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


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