; LLVM IR from Dev-XYS/Algorithms :: Tarjan(Strongly-Connected-Components).ll (Z3DFSi)

; 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, i32, i8 }
%struct.edge = type { i32, i32 }

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

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

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

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

21:                                               ; preds = %86, %1
  %22 = load i32, ptr %3, align 4, !tbaa !5
  %23 = icmp ne i32 %22, 0
  br i1 %23, label %25, label %24

24:                                               ; preds = %21
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #3
  br label %92

25:                                               ; preds = %21
  %26 = load i32, ptr %3, align 4, !tbaa !5
  %27 = sext i32 %26 to i64
  %28 = getelementptr inbounds [500010 x %struct.edge], ptr @E, i64 0, i64 %27
  %29 = getelementptr inbounds %struct.edge, ptr %28, i32 0, i32 0
  %30 = load i32, ptr %29, align 8, !tbaa !14
  %31 = sext i32 %30 to i64
  %32 = getelementptr inbounds [100010 x %struct.vertex], ptr @V, i64 0, i64 %31
  %33 = getelementptr inbounds %struct.vertex, ptr %32, i32 0, i32 1
  %34 = load i32, ptr %33, align 4, !tbaa !12
  %35 = icmp eq i32 %34, 0
  br i1 %35, label %36, label %42

36:                                               ; preds = %25
  %37 = load i32, ptr %3, align 4, !tbaa !5
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds [500010 x %struct.edge], ptr @E, i64 0, i64 %38
  %40 = getelementptr inbounds %struct.edge, ptr %39, i32 0, i32 0
  %41 = load i32, ptr %40, align 8, !tbaa !14
  call void @_Z3DFSi(i32 noundef %41)
  br label %42

42:                                               ; preds = %36, %25
  %43 = load i32, ptr %3, align 4, !tbaa !5
  %44 = sext i32 %43 to i64
  %45 = getelementptr inbounds [500010 x %struct.edge], ptr @E, i64 0, i64 %44
  %46 = getelementptr inbounds %struct.edge, ptr %45, i32 0, i32 0
  %47 = load i32, ptr %46, align 8, !tbaa !14
  %48 = sext i32 %47 to i64
  %49 = getelementptr inbounds [100010 x %struct.vertex], ptr @V, i64 0, i64 %48
  %50 = getelementptr inbounds %struct.vertex, ptr %49, i32 0, i32 4
  %51 = load i8, ptr %50, align 4, !tbaa !16, !range !17, !noundef !18
  %52 = trunc i8 %51 to i1
  %53 = zext i1 %52 to i32
  %54 = icmp eq i32 %53, 1
  br i1 %54, label %55, label %85

55:                                               ; preds = %42
  %56 = load i32, ptr %3, align 4, !tbaa !5
  %57 = sext i32 %56 to i64
  %58 = getelementptr inbounds [500010 x %struct.edge], ptr @E, i64 0, i64 %57
  %59 = getelementptr inbounds %struct.edge, ptr %58, i32 0, i32 0
  %60 = load i32, ptr %59, align 8, !tbaa !14
  %61 = sext i32 %60 to i64
  %62 = getelementptr inbounds [100010 x %struct.vertex], ptr @V, i64 0, i64 %61
  %63 = getelementptr inbounds %struct.vertex, ptr %62, i32 0, i32 2
  %64 = load i32, ptr %63, align 4, !tbaa !9
  %65 = load i32, ptr %2, align 4, !tbaa !5
  %66 = sext i32 %65 to i64
  %67 = getelementptr inbounds [100010 x %struct.vertex], ptr @V, i64 0, i64 %66
  %68 = getelementptr inbounds %struct.vertex, ptr %67, i32 0, i32 2
  %69 = load i32, ptr %68, align 4, !tbaa !9
  %70 = icmp slt i32 %64, %69
  br i1 %70, label %71, label %85

71:                                               ; preds = %55
  %72 = load i32, ptr %3, align 4, !tbaa !5
  %73 = sext i32 %72 to i64
  %74 = getelementptr inbounds [500010 x %struct.edge], ptr @E, i64 0, i64 %73
  %75 = getelementptr inbounds %struct.edge, ptr %74, i32 0, i32 0
  %76 = load i32, ptr %75, align 8, !tbaa !14
  %77 = sext i32 %76 to i64
  %78 = getelementptr inbounds [100010 x %struct.vertex], ptr @V, i64 0, i64 %77
  %79 = getelementptr inbounds %struct.vertex, ptr %78, i32 0, i32 2
  %80 = load i32, ptr %79, align 4, !tbaa !9
  %81 = load i32, ptr %2, align 4, !tbaa !5
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds [100010 x %struct.vertex], ptr @V, i64 0, i64 %82
  %84 = getelementptr inbounds %struct.vertex, ptr %83, i32 0, i32 2
  store i32 %80, ptr %84, align 4, !tbaa !9
  br label %85

85:                                               ; preds = %71, %55, %42
  br label %86

86:                                               ; preds = %85
  %87 = load i32, ptr %3, align 4, !tbaa !5
  %88 = sext i32 %87 to i64
  %89 = getelementptr inbounds [500010 x %struct.edge], ptr @E, i64 0, i64 %88
  %90 = getelementptr inbounds %struct.edge, ptr %89, i32 0, i32 1
  %91 = load i32, ptr %90, align 4, !tbaa !19
  store i32 %91, ptr %3, align 4, !tbaa !5
  br label %21, !llvm.loop !20

92:                                               ; preds = %24
  %93 = load i32, ptr %2, align 4, !tbaa !5
  %94 = sext i32 %93 to i64
  %95 = getelementptr inbounds [100010 x %struct.vertex], ptr @V, i64 0, i64 %94
  %96 = getelementptr inbounds %struct.vertex, ptr %95, i32 0, i32 2
  %97 = load i32, ptr %96, align 4, !tbaa !9
  %98 = load i32, ptr %2, align 4, !tbaa !5
  %99 = sext i32 %98 to i64
  %100 = getelementptr inbounds [100010 x %struct.vertex], ptr @V, i64 0, i64 %99
  %101 = getelementptr inbounds %struct.vertex, ptr %100, i32 0, i32 1
  %102 = load i32, ptr %101, align 4, !tbaa !12
  %103 = icmp eq i32 %97, %102
  br i1 %103, label %104, label %125

104:                                              ; preds = %92
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #3
  %105 = call noundef i32 @_Z3popv()
  store i32 %105, ptr %4, align 4, !tbaa !5
  br label %106

106:                                              ; preds = %110, %104
  %107 = load i32, ptr %4, align 4, !tbaa !5
  %108 = load i32, ptr %2, align 4, !tbaa !5
  %109 = icmp ne i32 %107, %108
  br i1 %109, label %110, label %117

110:                                              ; preds = %106
  %111 = load i32, ptr @col, align 4, !tbaa !5
  %112 = load i32, ptr %4, align 4, !tbaa !5
  %113 = sext i32 %112 to i64
  %114 = getelementptr inbounds [100010 x %struct.vertex], ptr @V, i64 0, i64 %113
  %115 = getelementptr inbounds %struct.vertex, ptr %114, i32 0, i32 3
  store i32 %111, ptr %115, align 4, !tbaa !22
  %116 = call noundef i32 @_Z3popv()
  store i32 %116, ptr %4, align 4, !tbaa !5
  br label %106, !llvm.loop !23

117:                                              ; preds = %106
  %118 = load i32, ptr @col, align 4, !tbaa !5
  %119 = load i32, ptr %4, align 4, !tbaa !5
  %120 = sext i32 %119 to i64
  %121 = getelementptr inbounds [100010 x %struct.vertex], ptr @V, i64 0, i64 %120
  %122 = getelementptr inbounds %struct.vertex, ptr %121, i32 0, i32 3
  store i32 %118, ptr %122, align 4, !tbaa !22
  %123 = load i32, ptr @col, align 4, !tbaa !5
  %124 = add nsw i32 %123, 1
  store i32 %124, ptr @col, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #3
  br label %125

125:                                              ; preds = %117, %92
  ret void
}

; 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

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 = { 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, !6, i64 12, !11, i64 16}
!11 = !{!"bool", !7, i64 0}
!12 = !{!10, !6, i64 4}
!13 = !{!10, !6, i64 0}
!14 = !{!15, !6, i64 0}
!15 = !{!"_ZTS4edge", !6, i64 0, !6, i64 4}
!16 = !{!10, !11, i64 16}
!17 = !{i8 0, i8 2}
!18 = !{}
!19 = !{!15, !6, i64 4}
!20 = distinct !{!20, !21}
!21 = !{!"llvm.loop.mustprogress"}
!22 = !{!10, !6, i64 12}
!23 = distinct !{!23, !21}


; 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, i32, i8 }
%struct.edge = type { i32, i32 }

@V = external dso_local local_unnamed_addr global [100010 x %struct.vertex], align 16
@E = external dso_local local_unnamed_addr global [500010 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
declare dso_local void @_Z4pushi(i32 noundef) local_unnamed_addr #0

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

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

._crit_edge:                                      ; preds = %30, %1
  %8 = load i32, ptr %6, align 4, !tbaa !9
  %9 = load i32, ptr %7, align 4, !tbaa !12
  %10 = icmp eq i32 %8, %9
  br i1 %10, label %32, label %41

.lr.ph:                                           ; preds = %1, %30
  %.01924 = phi i32 [ %.019, %30 ], [ %.01922, %1 ]
  %11 = sext i32 %.01924 to i64
  %12 = getelementptr inbounds [500010 x %struct.edge], ptr @E, i64 0, i64 %11
  %13 = load i32, ptr %12, align 8, !tbaa !13
  %14 = sext i32 %13 to i64
  %15 = getelementptr inbounds [100010 x %struct.vertex], ptr @V, i64 0, i64 %14, i32 1
  %16 = load i32, ptr %15, align 4, !tbaa !12
  %17 = icmp eq i32 %16, 0
  br i1 %17, label %18, label %19

18:                                               ; preds = %.lr.ph
  tail call void @_Z3DFSi(i32 noundef %13)
  %.pre = load i32, ptr %12, align 8, !tbaa !13
  %.pre30 = sext i32 %.pre to i64
  br label %19

19:                                               ; preds = %18, %.lr.ph
  %.pre-phi = phi i64 [ %.pre30, %18 ], [ %14, %.lr.ph ]
  %20 = getelementptr inbounds [100010 x %struct.vertex], ptr @V, i64 0, i64 %.pre-phi
  %21 = getelementptr inbounds i8, ptr %20, i64 16
  %22 = load i8, ptr %21, align 4, !tbaa !15, !range !16, !noundef !17
  %23 = trunc nuw i8 %22 to i1
  br i1 %23, label %24, label %30

24:                                               ; preds = %19
  %25 = getelementptr inbounds i8, ptr %20, i64 8
  %26 = load i32, ptr %25, align 4, !tbaa !9
  %27 = load i32, ptr %6, align 4, !tbaa !9
  %28 = icmp slt i32 %26, %27
  br i1 %28, label %29, label %30

29:                                               ; preds = %24
  store i32 %26, ptr %6, align 4, !tbaa !9
  br label %30

30:                                               ; preds = %19, %24, %29
  %31 = getelementptr inbounds i8, ptr %12, i64 4
  %.019 = load i32, ptr %31, align 4, !tbaa !5
  %.not = icmp eq i32 %.019, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph, !llvm.loop !18

32:                                               ; preds = %._crit_edge
  %33 = tail call noundef i32 @_Z3popv()
  %.not2125 = icmp eq i32 %33, %0
  br i1 %.not2125, label %._crit_edge29, label %.lr.ph28

.lr.ph28:                                         ; preds = %32, %.lr.ph28
  %.026 = phi i32 [ %37, %.lr.ph28 ], [ %33, %32 ]
  %34 = load i32, ptr @col, align 4, !tbaa !5
  %35 = sext i32 %.026 to i64
  %36 = getelementptr inbounds [100010 x %struct.vertex], ptr @V, i64 0, i64 %35, i32 3
  store i32 %34, ptr %36, align 4, !tbaa !20
  %37 = tail call noundef i32 @_Z3popv()
  %.not21 = icmp eq i32 %37, %0
  br i1 %.not21, label %._crit_edge29, label %.lr.ph28, !llvm.loop !21

._crit_edge29:                                    ; preds = %.lr.ph28, %32
  %38 = load i32, ptr @col, align 4, !tbaa !5
  %39 = getelementptr inbounds [100010 x %struct.vertex], ptr @V, i64 0, i64 %4, i32 3
  store i32 %38, ptr %39, align 4, !tbaa !20
  %40 = add nsw i32 %38, 1
  store i32 %40, ptr @col, align 4, !tbaa !5
  br label %41

41:                                               ; preds = %._crit_edge29, %._crit_edge
  ret void
}

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

!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, !6, i64 12, !11, i64 16}
!11 = !{!"bool", !7, i64 0}
!12 = !{!10, !6, i64 4}
!13 = !{!14, !6, i64 0}
!14 = !{!"_ZTS4edge", !6, i64 0, !6, i64 4}
!15 = !{!10, !11, i64 16}
!16 = !{i8 0, i8 2}
!17 = !{}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.mustprogress"}
!20 = !{!10, !6, i64 12}
!21 = distinct !{!21, !19}


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