; LLVM IR from AlgoGenesis/C :: Graph Algorithms/Articulation Points (Program)

; 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.Graph = type { i32, [100 x [100 x i32]] }

@.str.5 = external hidden unnamed_addr constant [39 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [2 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

declare i32 @printf(ptr noundef, ...) #1

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

; Function Attrs: nounwind uwtable
define dso_local void @findArticulationPoints(ptr noundef %0) #2 {
  %2 = alloca ptr, align 8
  %3 = alloca [100 x i32], align 16
  %4 = alloca [100 x i32], align 16
  %5 = alloca [100 x i32], align 16
  %6 = alloca [100 x i32], align 16
  %7 = alloca [100 x i32], align 16
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 400, ptr %3) #3
  call void @llvm.lifetime.start.p0(i64 400, ptr %4) #3
  call void @llvm.lifetime.start.p0(i64 400, ptr %5) #3
  call void @llvm.lifetime.start.p0(i64 400, ptr %6) #3
  call void @llvm.lifetime.start.p0(i64 400, ptr %7) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #3
  store i32 0, ptr %8, align 4, !tbaa !9
  br label %11

11:                                               ; preds = %34, %1
  %12 = load i32, ptr %8, align 4, !tbaa !9
  %13 = load ptr, ptr %2, align 8, !tbaa !5
  %14 = getelementptr inbounds %struct.Graph, ptr %13, i32 0, i32 0
  %15 = load i32, ptr %14, align 4, !tbaa !11
  %16 = icmp slt i32 %12, %15
  br i1 %16, label %18, label %17

17:                                               ; preds = %11
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #3
  br label %37

18:                                               ; preds = %11
  %19 = load i32, ptr %8, align 4, !tbaa !9
  %20 = sext i32 %19 to i64
  %21 = getelementptr inbounds [100 x i32], ptr %3, i64 0, i64 %20
  store i32 0, ptr %21, align 4, !tbaa !9
  %22 = load i32, ptr %8, align 4, !tbaa !9
  %23 = sext i32 %22 to i64
  %24 = getelementptr inbounds [100 x i32], ptr %4, i64 0, i64 %23
  store i32 -1, ptr %24, align 4, !tbaa !9
  %25 = load i32, ptr %8, align 4, !tbaa !9
  %26 = sext i32 %25 to i64
  %27 = getelementptr inbounds [100 x i32], ptr %5, i64 0, i64 %26
  store i32 -1, ptr %27, align 4, !tbaa !9
  %28 = load i32, ptr %8, align 4, !tbaa !9
  %29 = sext i32 %28 to i64
  %30 = getelementptr inbounds [100 x i32], ptr %6, i64 0, i64 %29
  store i32 -1, ptr %30, align 4, !tbaa !9
  %31 = load i32, ptr %8, align 4, !tbaa !9
  %32 = sext i32 %31 to i64
  %33 = getelementptr inbounds [100 x i32], ptr %7, i64 0, i64 %32
  store i32 0, ptr %33, align 4, !tbaa !9
  br label %34

34:                                               ; preds = %18
  %35 = load i32, ptr %8, align 4, !tbaa !9
  %36 = add nsw i32 %35, 1
  store i32 %36, ptr %8, align 4, !tbaa !9
  br label %11, !llvm.loop !13

37:                                               ; preds = %17
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #3
  store i32 0, ptr %9, align 4, !tbaa !9
  br label %38

38:                                               ; preds = %60, %37
  %39 = load i32, ptr %9, align 4, !tbaa !9
  %40 = load ptr, ptr %2, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct.Graph, ptr %40, i32 0, i32 0
  %42 = load i32, ptr %41, align 4, !tbaa !11
  %43 = icmp slt i32 %39, %42
  br i1 %43, label %45, label %44

44:                                               ; preds = %38
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #3
  br label %63

45:                                               ; preds = %38
  %46 = load i32, ptr %9, align 4, !tbaa !9
  %47 = sext i32 %46 to i64
  %48 = getelementptr inbounds [100 x i32], ptr %3, i64 0, i64 %47
  %49 = load i32, ptr %48, align 4, !tbaa !9
  %50 = icmp ne i32 %49, 0
  br i1 %50, label %59, label %51

51:                                               ; preds = %45
  %52 = load ptr, ptr %2, align 8, !tbaa !5
  %53 = load i32, ptr %9, align 4, !tbaa !9
  %54 = getelementptr inbounds [100 x i32], ptr %3, i64 0, i64 0
  %55 = getelementptr inbounds [100 x i32], ptr %4, i64 0, i64 0
  %56 = getelementptr inbounds [100 x i32], ptr %5, i64 0, i64 0
  %57 = getelementptr inbounds [100 x i32], ptr %6, i64 0, i64 0
  %58 = getelementptr inbounds [100 x i32], ptr %7, i64 0, i64 0
  call void @articulationPointsUtil(ptr noundef %52, i32 noundef %53, ptr noundef %54, ptr noundef %55, ptr noundef %56, ptr noundef %57, ptr noundef %58)
  br label %59

59:                                               ; preds = %51, %45
  br label %60

60:                                               ; preds = %59
  %61 = load i32, ptr %9, align 4, !tbaa !9
  %62 = add nsw i32 %61, 1
  store i32 %62, ptr %9, align 4, !tbaa !9
  br label %38, !llvm.loop !15

63:                                               ; preds = %44
  %64 = call i32 (ptr, ...) @printf(ptr noundef @.str.5)
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #3
  store i32 0, ptr %10, align 4, !tbaa !9
  br label %65

65:                                               ; preds = %82, %63
  %66 = load i32, ptr %10, align 4, !tbaa !9
  %67 = load ptr, ptr %2, align 8, !tbaa !5
  %68 = getelementptr inbounds %struct.Graph, ptr %67, i32 0, i32 0
  %69 = load i32, ptr %68, align 4, !tbaa !11
  %70 = icmp slt i32 %66, %69
  br i1 %70, label %72, label %71

71:                                               ; preds = %65
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #3
  br label %85

72:                                               ; preds = %65
  %73 = load i32, ptr %10, align 4, !tbaa !9
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds [100 x i32], ptr %7, i64 0, i64 %74
  %76 = load i32, ptr %75, align 4, !tbaa !9
  %77 = icmp ne i32 %76, 0
  br i1 %77, label %78, label %81

78:                                               ; preds = %72
  %79 = load i32, ptr %10, align 4, !tbaa !9
  %80 = call i32 (ptr, ...) @printf(ptr noundef @.str.6, i32 noundef %79)
  br label %81

81:                                               ; preds = %78, %72
  br label %82

82:                                               ; preds = %81
  %83 = load i32, ptr %10, align 4, !tbaa !9
  %84 = add nsw i32 %83, 1
  store i32 %84, ptr %10, align 4, !tbaa !9
  br label %65, !llvm.loop !16

85:                                               ; preds = %71
  %86 = call i32 (ptr, ...) @printf(ptr noundef @.str.7)
  call void @llvm.lifetime.end.p0(i64 400, ptr %7) #3
  call void @llvm.lifetime.end.p0(i64 400, ptr %6) #3
  call void @llvm.lifetime.end.p0(i64 400, ptr %5) #3
  call void @llvm.lifetime.end.p0(i64 400, ptr %4) #3
  call void @llvm.lifetime.end.p0(i64 400, ptr %3) #3
  ret void
}

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "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 = { 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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 0}
!12 = !{!"", !10, i64 0, !7, i64 4}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = distinct !{!16, !14}


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

@.str.5 = external hidden unnamed_addr constant [39 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [2 x i8], align 1

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

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1

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

; Function Attrs: nounwind uwtable
define dso_local void @findArticulationPoints(ptr noundef %0) local_unnamed_addr #2 {
  %2 = alloca [100 x i32], align 16
  %3 = alloca [100 x i32], align 16
  %4 = alloca [100 x i32], align 16
  %5 = alloca [100 x i32], align 16
  %6 = alloca [100 x i32], align 16
  call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %2) #4
  call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %3) #4
  call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %4) #4
  call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %5) #4
  call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %6) #4
  %7 = load i32, ptr %0, align 4, !tbaa !5
  %8 = icmp sgt i32 %7, 0
  br i1 %8, label %.lr.ph23.preheader, label %._crit_edge

.lr.ph23.preheader:                               ; preds = %1
  %9 = zext nneg i32 %7 to i64
  %10 = shl nuw nsw i64 %9, 2
  call void @llvm.memset.p0.i64(ptr nonnull align 16 %2, i8 0, i64 %10, i1 false), !tbaa !10
  call void @llvm.memset.p0.i64(ptr nonnull align 16 %3, i8 -1, i64 %10, i1 false), !tbaa !10
  call void @llvm.memset.p0.i64(ptr nonnull align 16 %4, i8 -1, i64 %10, i1 false), !tbaa !10
  call void @llvm.memset.p0.i64(ptr nonnull align 16 %5, i8 -1, i64 %10, i1 false), !tbaa !10
  call void @llvm.memset.p0.i64(ptr nonnull align 16 %6, i8 0, i64 %10, i1 false), !tbaa !10
  br label %.lr.ph23

._crit_edge:                                      ; preds = %19, %1
  %11 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5)
  %12 = load i32, ptr %0, align 4, !tbaa !5
  %13 = icmp sgt i32 %12, 0
  br i1 %13, label %.lr.ph26, label %._crit_edge27

.lr.ph23:                                         ; preds = %.lr.ph23.preheader, %19
  %14 = phi i32 [ %7, %.lr.ph23.preheader ], [ %20, %19 ]
  %indvars.iv = phi i64 [ 0, %.lr.ph23.preheader ], [ %indvars.iv.next, %19 ]
  %15 = getelementptr inbounds [100 x i32], ptr %2, i64 0, i64 %indvars.iv
  %16 = load i32, ptr %15, align 4, !tbaa !10
  %.not20 = icmp eq i32 %16, 0
  br i1 %.not20, label %17, label %19

17:                                               ; preds = %.lr.ph23
  %18 = trunc nuw nsw i64 %indvars.iv to i32
  call void @articulationPointsUtil(ptr noundef nonnull %0, i32 noundef %18, ptr noundef nonnull %2, ptr noundef nonnull %3, ptr noundef nonnull %4, ptr noundef nonnull %5, ptr noundef nonnull %6)
  %.pre = load i32, ptr %0, align 4, !tbaa !5
  br label %19

19:                                               ; preds = %.lr.ph23, %17
  %20 = phi i32 [ %14, %.lr.ph23 ], [ %.pre, %17 ]
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %21 = sext i32 %20 to i64
  %22 = icmp slt i64 %indvars.iv.next, %21
  br i1 %22, label %.lr.ph23, label %._crit_edge, !llvm.loop !11

._crit_edge27:                                    ; preds = %30, %._crit_edge
  %23 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.7)
  call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %6) #4
  call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %5) #4
  call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %4) #4
  call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %3) #4
  call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %2) #4
  ret void

.lr.ph26:                                         ; preds = %._crit_edge, %30
  %24 = phi i32 [ %31, %30 ], [ %12, %._crit_edge ]
  %indvars.iv30 = phi i64 [ %indvars.iv.next31, %30 ], [ 0, %._crit_edge ]
  %25 = getelementptr inbounds [100 x i32], ptr %6, i64 0, i64 %indvars.iv30
  %26 = load i32, ptr %25, align 4, !tbaa !10
  %.not = icmp eq i32 %26, 0
  br i1 %.not, label %30, label %27

27:                                               ; preds = %.lr.ph26
  %28 = trunc nuw nsw i64 %indvars.iv30 to i32
  %29 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, i32 noundef %28)
  %.pre33 = load i32, ptr %0, align 4, !tbaa !5
  br label %30

30:                                               ; preds = %.lr.ph26, %27
  %31 = phi i32 [ %24, %.lr.ph26 ], [ %.pre33, %27 ]
  %indvars.iv.next31 = add nuw nsw i64 %indvars.iv30, 1
  %32 = sext i32 %31 to i64
  %33 = icmp slt i64 %indvars.iv.next31, %32
  br i1 %33, label %.lr.ph26, label %._crit_edge27, !llvm.loop !13
}

; Function Attrs: nounwind uwtable
declare dso_local void @articulationPointsUtil(ptr noundef, i32 noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nofree nounwind "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 = { 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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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, !7, i64 0}
!6 = !{!"", !7, i64 0, !8, i64 4}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!7, !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopIdiomRecognizePass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass