; LLVM IR from stivalaa/EstimNetDirected :: src (graph)

; 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_s = type { i32, i32, i32, i32, ptr, ptr, ptr, ptr, ptr, i32, ptr, ptr, ptr, i32, i32, i32, ptr, ptr, i32, ptr, ptr, i32, ptr, ptr, i32, ptr, ptr, ptr, i32, i32, i32, i32, i32, ptr, i32, i32, ptr, ptr, i32, ptr, i32, ptr, ptr, i32, i32, ptr, i32, ptr }

@.str.54 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.59 = external hidden unnamed_addr constant [43 x i8], align 1
@.str.61 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.62 = external hidden unnamed_addr constant [36 x i8], align 1
@.str.84 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.85 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.86 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.87 = external hidden unnamed_addr constant [52 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 willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

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

; Function Attrs: nounwind uwtable
define dso_local void @dump_zone_info(ptr noundef %0) #2 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #3
  %6 = load ptr, ptr %2, align 8, !tbaa !5
  %7 = getelementptr inbounds %struct.graph_s, ptr %6, i32 0, i32 34
  %8 = load i32, ptr %7, align 8, !tbaa !9
  %9 = add i32 %8, 1
  store i32 %9, ptr %4, align 4, !tbaa !12
  %10 = load i32, ptr %4, align 4, !tbaa !12
  %11 = icmp eq i32 %10, 1
  br i1 %11, label %12, label %14

12:                                               ; preds = %1
  %13 = call i32 (ptr, ...) @printf(ptr noundef @.str.59)
  store i32 1, ptr %5, align 4
  br label %86

14:                                               ; preds = %1
  %15 = load i32, ptr %4, align 4, !tbaa !12
  %16 = load i32, ptr %4, align 4, !tbaa !12
  %17 = sub i32 %16, 1
  %18 = call i32 (ptr, ...) @printf(ptr noundef @.str.61, i32 noundef %15, i32 noundef %17)
  %19 = load ptr, ptr %2, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct.graph_s, ptr %19, i32 0, i32 35
  %21 = load i32, ptr %20, align 4, !tbaa !13
  %22 = call i32 (ptr, ...) @printf(ptr noundef @.str.62, i32 noundef %21)
  %23 = call i32 (ptr, ...) @printf(ptr noundef @.str.84)
  store i32 0, ptr %3, align 4, !tbaa !12
  br label %24

24:                                               ; preds = %39, %14
  %25 = load i32, ptr %3, align 4, !tbaa !12
  %26 = load ptr, ptr %2, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.graph_s, ptr %26, i32 0, i32 35
  %28 = load i32, ptr %27, align 4, !tbaa !13
  %29 = icmp ult i32 %25, %28
  br i1 %29, label %30, label %42

30:                                               ; preds = %24
  %31 = load ptr, ptr %2, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.graph_s, ptr %31, i32 0, i32 36
  %33 = load ptr, ptr %32, align 8, !tbaa !14
  %34 = load i32, ptr %3, align 4, !tbaa !12
  %35 = zext i32 %34 to i64
  %36 = getelementptr inbounds i32, ptr %33, i64 %35
  %37 = load i32, ptr %36, align 4, !tbaa !12
  %38 = call i32 (ptr, ...) @printf(ptr noundef @.str.85, i32 noundef %37)
  br label %39

39:                                               ; preds = %30
  %40 = load i32, ptr %3, align 4, !tbaa !12
  %41 = add i32 %40, 1
  store i32 %41, ptr %3, align 4, !tbaa !12
  br label %24, !llvm.loop !15

42:                                               ; preds = %24
  %43 = call i32 (ptr, ...) @printf(ptr noundef @.str.54)
  %44 = call i32 (ptr, ...) @printf(ptr noundef @.str.86)
  store i32 0, ptr %3, align 4, !tbaa !12
  br label %45

45:                                               ; preds = %60, %42
  %46 = load i32, ptr %3, align 4, !tbaa !12
  %47 = load ptr, ptr %2, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.graph_s, ptr %47, i32 0, i32 0
  %49 = load i32, ptr %48, align 8, !tbaa !17
  %50 = icmp ult i32 %46, %49
  br i1 %50, label %51, label %63

51:                                               ; preds = %45
  %52 = load ptr, ptr %2, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.graph_s, ptr %52, i32 0, i32 33
  %54 = load ptr, ptr %53, align 8, !tbaa !18
  %55 = load i32, ptr %3, align 4, !tbaa !12
  %56 = zext i32 %55 to i64
  %57 = getelementptr inbounds i32, ptr %54, i64 %56
  %58 = load i32, ptr %57, align 4, !tbaa !12
  %59 = call i32 (ptr, ...) @printf(ptr noundef @.str.85, i32 noundef %58)
  br label %60

60:                                               ; preds = %51
  %61 = load i32, ptr %3, align 4, !tbaa !12
  %62 = add i32 %61, 1
  store i32 %62, ptr %3, align 4, !tbaa !12
  br label %45, !llvm.loop !19

63:                                               ; preds = %45
  %64 = call i32 (ptr, ...) @printf(ptr noundef @.str.54)
  %65 = call i32 (ptr, ...) @printf(ptr noundef @.str.87)
  store i32 0, ptr %3, align 4, !tbaa !12
  br label %66

66:                                               ; preds = %81, %63
  %67 = load i32, ptr %3, align 4, !tbaa !12
  %68 = load ptr, ptr %2, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct.graph_s, ptr %68, i32 0, i32 0
  %70 = load i32, ptr %69, align 8, !tbaa !17
  %71 = icmp ult i32 %67, %70
  br i1 %71, label %72, label %84

72:                                               ; preds = %66
  %73 = load ptr, ptr %2, align 8, !tbaa !5
  %74 = getelementptr inbounds %struct.graph_s, ptr %73, i32 0, i32 37
  %75 = load ptr, ptr %74, align 8, !tbaa !20
  %76 = load i32, ptr %3, align 4, !tbaa !12
  %77 = zext i32 %76 to i64
  %78 = getelementptr inbounds i32, ptr %75, i64 %77
  %79 = load i32, ptr %78, align 4, !tbaa !12
  %80 = call i32 (ptr, ...) @printf(ptr noundef @.str.85, i32 noundef %79)
  br label %81

81:                                               ; preds = %72
  %82 = load i32, ptr %3, align 4, !tbaa !12
  %83 = add i32 %82, 1
  store i32 %83, ptr %3, align 4, !tbaa !12
  br label %66, !llvm.loop !21

84:                                               ; preds = %66
  %85 = call i32 (ptr, ...) @printf(ptr noundef @.str.54)
  store i32 0, ptr %5, align 4
  br label %86

86:                                               ; preds = %84, %12
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #3
  %87 = load i32, ptr %5, align 4
  switch i32 %87, label %89 [
    i32 0, label %88
    i32 1, label %88
  ]

88:                                               ; preds = %86, %86
  ret void

89:                                               ; preds = %86
  unreachable
}

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, !11, i64 232}
!10 = !{!"graph_s", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !11, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !11, i64 88, !11, i64 92, !11, i64 96, !6, i64 104, !6, i64 112, !11, i64 120, !6, i64 128, !6, i64 136, !11, i64 144, !6, i64 152, !6, i64 160, !11, i64 168, !6, i64 176, !6, i64 184, !6, i64 192, !11, i64 200, !11, i64 204, !11, i64 208, !11, i64 212, !11, i64 216, !6, i64 224, !11, i64 232, !11, i64 236, !6, i64 240, !6, i64 248, !11, i64 256, !6, i64 264, !11, i64 272, !6, i64 280, !6, i64 288, !11, i64 296, !11, i64 300, !6, i64 304, !11, i64 312, !6, i64 320}
!11 = !{!"int", !7, i64 0}
!12 = !{!11, !11, i64 0}
!13 = !{!10, !11, i64 236}
!14 = !{!10, !6, i64 240}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = !{!10, !11, i64 0}
!18 = !{!10, !6, i64 224}
!19 = distinct !{!19, !16}
!20 = !{!10, !6, i64 248}
!21 = distinct !{!21, !16}


; 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.54 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.59 = external hidden unnamed_addr constant [43 x i8], align 1
@.str.61 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.62 = external hidden unnamed_addr constant [36 x i8], align 1
@.str.84 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.85 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.86 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.87 = external hidden unnamed_addr constant [52 x i8], align 1

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

; Function Attrs: nofree nounwind uwtable
define dso_local void @dump_zone_info(ptr nocapture noundef readonly %0) local_unnamed_addr #1 {
  %2 = getelementptr inbounds i8, ptr %0, i64 232
  %3 = load i32, ptr %2, align 8, !tbaa !5
  %4 = icmp eq i32 %3, 0
  br i1 %4, label %._crit_edge28, label %5

5:                                                ; preds = %1
  %6 = add i32 %3, 1
  %7 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.61, i32 noundef %6, i32 noundef %3)
  %8 = getelementptr inbounds i8, ptr %0, i64 236
  %9 = load i32, ptr %8, align 4, !tbaa !11
  %10 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.62, i32 noundef %9)
  %11 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.84)
  %12 = load i32, ptr %8, align 4, !tbaa !11
  %.not = icmp eq i32 %12, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %5
  %13 = getelementptr inbounds i8, ptr %0, i64 240
  br label %14

14:                                               ; preds = %.lr.ph, %14
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %14 ]
  %15 = load ptr, ptr %13, align 8, !tbaa !12
  %16 = getelementptr inbounds i32, ptr %15, i64 %indvars.iv
  %17 = load i32, ptr %16, align 4, !tbaa !13
  %18 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.85, i32 noundef %17)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %19 = load i32, ptr %8, align 4, !tbaa !11
  %20 = zext i32 %19 to i64
  %21 = icmp ult i64 %indvars.iv.next, %20
  br i1 %21, label %14, label %._crit_edge, !llvm.loop !14

._crit_edge:                                      ; preds = %14, %5
  %22 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.54)
  %23 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.86)
  %24 = load i32, ptr %0, align 8, !tbaa !16
  %.not29 = icmp eq i32 %24, 0
  br i1 %.not29, label %._crit_edge24, label %.lr.ph23

.lr.ph23:                                         ; preds = %._crit_edge
  %25 = getelementptr inbounds i8, ptr %0, i64 224
  br label %26

26:                                               ; preds = %.lr.ph23, %26
  %indvars.iv32 = phi i64 [ 0, %.lr.ph23 ], [ %indvars.iv.next33, %26 ]
  %27 = load ptr, ptr %25, align 8, !tbaa !17
  %28 = getelementptr inbounds i32, ptr %27, i64 %indvars.iv32
  %29 = load i32, ptr %28, align 4, !tbaa !13
  %30 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.85, i32 noundef %29)
  %indvars.iv.next33 = add nuw nsw i64 %indvars.iv32, 1
  %31 = load i32, ptr %0, align 8, !tbaa !16
  %32 = zext i32 %31 to i64
  %33 = icmp ult i64 %indvars.iv.next33, %32
  br i1 %33, label %26, label %._crit_edge24, !llvm.loop !18

._crit_edge24:                                    ; preds = %26, %._crit_edge
  %34 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.54)
  %35 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.87)
  %36 = load i32, ptr %0, align 8, !tbaa !16
  %.not30 = icmp eq i32 %36, 0
  br i1 %.not30, label %._crit_edge28, label %.lr.ph27

.lr.ph27:                                         ; preds = %._crit_edge24
  %37 = getelementptr inbounds i8, ptr %0, i64 248
  br label %38

38:                                               ; preds = %.lr.ph27, %38
  %indvars.iv35 = phi i64 [ 0, %.lr.ph27 ], [ %indvars.iv.next36, %38 ]
  %39 = load ptr, ptr %37, align 8, !tbaa !19
  %40 = getelementptr inbounds i32, ptr %39, i64 %indvars.iv35
  %41 = load i32, ptr %40, align 4, !tbaa !13
  %42 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.85, i32 noundef %41)
  %indvars.iv.next36 = add nuw nsw i64 %indvars.iv35, 1
  %43 = load i32, ptr %0, align 8, !tbaa !16
  %44 = zext i32 %43 to i64
  %45 = icmp ult i64 %indvars.iv.next36, %44
  br i1 %45, label %38, label %._crit_edge28, !llvm.loop !20

._crit_edge28:                                    ; preds = %38, %._crit_edge24, %1
  %.str.54.sink = phi ptr [ @.str.59, %1 ], [ @.str.54, %._crit_edge24 ], [ @.str.54, %38 ]
  %46 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.54.sink)
  ret void
}

attributes #0 = { 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 #1 = { nofree 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, !7, i64 232}
!6 = !{!"graph_s", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !7, i64 56, !10, i64 64, !10, i64 72, !10, i64 80, !7, i64 88, !7, i64 92, !7, i64 96, !10, i64 104, !10, i64 112, !7, i64 120, !10, i64 128, !10, i64 136, !7, i64 144, !10, i64 152, !10, i64 160, !7, i64 168, !10, i64 176, !10, i64 184, !10, i64 192, !7, i64 200, !7, i64 204, !7, i64 208, !7, i64 212, !7, i64 216, !10, i64 224, !7, i64 232, !7, i64 236, !10, i64 240, !10, i64 248, !7, i64 256, !10, i64 264, !7, i64 272, !10, i64 280, !10, i64 288, !7, i64 296, !7, i64 300, !10, i64 304, !7, i64 312, !10, i64 320}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!6, !7, i64 236}
!12 = !{!6, !10, i64 240}
!13 = !{!7, !7, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = !{!6, !7, i64 0}
!17 = !{!6, !10, i64 224}
!18 = distinct !{!18, !15}
!19 = !{!6, !10, i64 248}
!20 = distinct !{!20, !15}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass