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

@.str = external hidden unnamed_addr constant [15 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [71 x i8], align 1
@.str.29 = external hidden unnamed_addr constant [55 x i8], align 1
@__PRETTY_FUNCTION__.removeArc_all_maxtermsender_arcs = external hidden unnamed_addr constant [73 x i8], align 1
@.str.30 = external hidden unnamed_addr constant [35 x i8], align 1
@.str.31 = external hidden unnamed_addr constant [85 x i8], align 1

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #0

declare ptr @safe_realloc(ptr noundef, i64 noundef) #1

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

; Function Attrs: nounwind uwtable
define dso_local void @removeArc_all_maxtermsender_arcs(ptr noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3) #2 {
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store i32 %1, ptr %6, align 4, !tbaa !9
  store i32 %2, ptr %7, align 4, !tbaa !9
  store i32 %3, ptr %8, align 4, !tbaa !9
  %9 = load ptr, ptr %5, align 8, !tbaa !5
  %10 = getelementptr inbounds %struct.graph_s, ptr %9, i32 0, i32 1
  %11 = load i32, ptr %10, align 4, !tbaa !11
  %12 = icmp ne i32 %11, 0
  br i1 %12, label %13, label %14

13:                                               ; preds = %4
  br label %15

14:                                               ; preds = %4
  call void @__assert_fail(ptr noundef @.str, ptr noundef @.str.1, i32 noundef 1706, ptr noundef @__PRETTY_FUNCTION__.removeArc_all_maxtermsender_arcs) #3
  unreachable

15:                                               ; preds = %13
  %16 = load ptr, ptr %5, align 8, !tbaa !5
  %17 = getelementptr inbounds %struct.graph_s, ptr %16, i32 0, i32 42
  %18 = load ptr, ptr %17, align 8, !tbaa !13
  %19 = load i32, ptr %6, align 4, !tbaa !9
  %20 = zext i32 %19 to i64
  %21 = getelementptr inbounds i32, ptr %18, i64 %20
  %22 = load i32, ptr %21, align 4, !tbaa !9
  %23 = load ptr, ptr %5, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct.graph_s, ptr %23, i32 0, i32 43
  %25 = load i32, ptr %24, align 8, !tbaa !14
  %26 = icmp eq i32 %22, %25
  br i1 %26, label %27, label %40

27:                                               ; preds = %15
  %28 = load ptr, ptr %5, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.graph_s, ptr %28, i32 0, i32 42
  %30 = load ptr, ptr %29, align 8, !tbaa !13
  %31 = load i32, ptr %7, align 4, !tbaa !9
  %32 = zext i32 %31 to i64
  %33 = getelementptr inbounds i32, ptr %30, i64 %32
  %34 = load i32, ptr %33, align 4, !tbaa !9
  %35 = load ptr, ptr %5, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct.graph_s, ptr %35, i32 0, i32 43
  %37 = load i32, ptr %36, align 8, !tbaa !14
  %38 = icmp ule i32 %34, %37
  br i1 %38, label %39, label %40

39:                                               ; preds = %27
  br label %41

40:                                               ; preds = %27, %15
  call void @__assert_fail(ptr noundef @.str.29, ptr noundef @.str.1, i32 noundef 1707, ptr noundef @__PRETTY_FUNCTION__.removeArc_all_maxtermsender_arcs) #3
  unreachable

41:                                               ; preds = %39
  %42 = load i32, ptr %8, align 4, !tbaa !9
  %43 = load ptr, ptr %5, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.graph_s, ptr %43, i32 0, i32 46
  %45 = load i32, ptr %44, align 8, !tbaa !15
  %46 = icmp ult i32 %42, %45
  br i1 %46, label %47, label %48

47:                                               ; preds = %41
  br label %49

48:                                               ; preds = %41
  call void @__assert_fail(ptr noundef @.str.30, ptr noundef @.str.1, i32 noundef 1708, ptr noundef @__PRETTY_FUNCTION__.removeArc_all_maxtermsender_arcs) #3
  unreachable

49:                                               ; preds = %47
  %50 = load ptr, ptr %5, align 8, !tbaa !5
  %51 = load i32, ptr %6, align 4, !tbaa !9
  %52 = load i32, ptr %7, align 4, !tbaa !9
  call void @removeArc(ptr noundef %50, i32 noundef %51, i32 noundef %52)
  %53 = load ptr, ptr %5, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct.graph_s, ptr %53, i32 0, i32 47
  %55 = load ptr, ptr %54, align 8, !tbaa !16
  %56 = load i32, ptr %8, align 4, !tbaa !9
  %57 = zext i32 %56 to i64
  %58 = getelementptr inbounds %struct.nodepair_s, ptr %55, i64 %57
  %59 = getelementptr inbounds %struct.nodepair_s, ptr %58, i32 0, i32 0
  %60 = load i32, ptr %59, align 4, !tbaa !17
  %61 = load i32, ptr %6, align 4, !tbaa !9
  %62 = icmp eq i32 %60, %61
  br i1 %62, label %63, label %75

63:                                               ; preds = %49
  %64 = load ptr, ptr %5, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct.graph_s, ptr %64, i32 0, i32 47
  %66 = load ptr, ptr %65, align 8, !tbaa !16
  %67 = load i32, ptr %8, align 4, !tbaa !9
  %68 = zext i32 %67 to i64
  %69 = getelementptr inbounds %struct.nodepair_s, ptr %66, i64 %68
  %70 = getelementptr inbounds %struct.nodepair_s, ptr %69, i32 0, i32 1
  %71 = load i32, ptr %70, align 4, !tbaa !19
  %72 = load i32, ptr %7, align 4, !tbaa !9
  %73 = icmp eq i32 %71, %72
  br i1 %73, label %74, label %75

74:                                               ; preds = %63
  br label %76

75:                                               ; preds = %63, %49
  call void @__assert_fail(ptr noundef @.str.31, ptr noundef @.str.1, i32 noundef 1711, ptr noundef @__PRETTY_FUNCTION__.removeArc_all_maxtermsender_arcs) #3
  unreachable

76:                                               ; preds = %74
  %77 = load ptr, ptr %5, align 8, !tbaa !5
  %78 = getelementptr inbounds %struct.graph_s, ptr %77, i32 0, i32 46
  %79 = load i32, ptr %78, align 8, !tbaa !15
  %80 = add i32 %79, -1
  store i32 %80, ptr %78, align 8, !tbaa !15
  %81 = load ptr, ptr %5, align 8, !tbaa !5
  %82 = getelementptr inbounds %struct.graph_s, ptr %81, i32 0, i32 47
  %83 = load ptr, ptr %82, align 8, !tbaa !16
  %84 = load ptr, ptr %5, align 8, !tbaa !5
  %85 = getelementptr inbounds %struct.graph_s, ptr %84, i32 0, i32 46
  %86 = load i32, ptr %85, align 8, !tbaa !15
  %87 = zext i32 %86 to i64
  %88 = getelementptr inbounds %struct.nodepair_s, ptr %83, i64 %87
  %89 = getelementptr inbounds %struct.nodepair_s, ptr %88, i32 0, i32 0
  %90 = load i32, ptr %89, align 4, !tbaa !17
  %91 = load ptr, ptr %5, align 8, !tbaa !5
  %92 = getelementptr inbounds %struct.graph_s, ptr %91, i32 0, i32 47
  %93 = load ptr, ptr %92, align 8, !tbaa !16
  %94 = load i32, ptr %8, align 4, !tbaa !9
  %95 = zext i32 %94 to i64
  %96 = getelementptr inbounds %struct.nodepair_s, ptr %93, i64 %95
  %97 = getelementptr inbounds %struct.nodepair_s, ptr %96, i32 0, i32 0
  store i32 %90, ptr %97, align 4, !tbaa !17
  %98 = load ptr, ptr %5, align 8, !tbaa !5
  %99 = getelementptr inbounds %struct.graph_s, ptr %98, i32 0, i32 47
  %100 = load ptr, ptr %99, align 8, !tbaa !16
  %101 = load ptr, ptr %5, align 8, !tbaa !5
  %102 = getelementptr inbounds %struct.graph_s, ptr %101, i32 0, i32 46
  %103 = load i32, ptr %102, align 8, !tbaa !15
  %104 = zext i32 %103 to i64
  %105 = getelementptr inbounds %struct.nodepair_s, ptr %100, i64 %104
  %106 = getelementptr inbounds %struct.nodepair_s, ptr %105, i32 0, i32 1
  %107 = load i32, ptr %106, align 4, !tbaa !19
  %108 = load ptr, ptr %5, align 8, !tbaa !5
  %109 = getelementptr inbounds %struct.graph_s, ptr %108, i32 0, i32 47
  %110 = load ptr, ptr %109, align 8, !tbaa !16
  %111 = load i32, ptr %8, align 4, !tbaa !9
  %112 = zext i32 %111 to i64
  %113 = getelementptr inbounds %struct.nodepair_s, ptr %110, i64 %112
  %114 = getelementptr inbounds %struct.nodepair_s, ptr %113, i32 0, i32 1
  store i32 %107, ptr %114, align 4, !tbaa !19
  %115 = load ptr, ptr %5, align 8, !tbaa !5
  %116 = getelementptr inbounds %struct.graph_s, ptr %115, i32 0, i32 47
  %117 = load ptr, ptr %116, align 8, !tbaa !16
  %118 = load ptr, ptr %5, align 8, !tbaa !5
  %119 = getelementptr inbounds %struct.graph_s, ptr %118, i32 0, i32 46
  %120 = load i32, ptr %119, align 8, !tbaa !15
  %121 = zext i32 %120 to i64
  %122 = mul i64 %121, 8
  %123 = call ptr @safe_realloc(ptr noundef %117, i64 noundef %122)
  %124 = load ptr, ptr %5, align 8, !tbaa !5
  %125 = getelementptr inbounds %struct.graph_s, ptr %124, i32 0, i32 47
  store ptr %123, ptr %125, align 8, !tbaa !16
  ret void
}

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


; 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.nodepair_s = type { i32, i32 }

@.str = external hidden unnamed_addr constant [15 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [71 x i8], align 1
@.str.29 = external hidden unnamed_addr constant [55 x i8], align 1
@__PRETTY_FUNCTION__.removeArc_all_maxtermsender_arcs = external hidden unnamed_addr constant [73 x i8], align 1
@.str.30 = external hidden unnamed_addr constant [35 x i8], align 1
@.str.31 = external hidden unnamed_addr constant [85 x i8], align 1

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #0

declare ptr @safe_realloc(ptr noundef, i64 noundef) local_unnamed_addr #1

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

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

7:                                                ; preds = %4
  tail call void @__assert_fail(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 1706, ptr noundef nonnull @__PRETTY_FUNCTION__.removeArc_all_maxtermsender_arcs) #3
  unreachable

8:                                                ; preds = %4
  %9 = getelementptr inbounds i8, ptr %0, i64 288
  %10 = load ptr, ptr %9, align 8, !tbaa !11
  %11 = zext i32 %1 to i64
  %12 = getelementptr inbounds i32, ptr %10, i64 %11
  %13 = load i32, ptr %12, align 4, !tbaa !12
  %14 = getelementptr inbounds i8, ptr %0, i64 296
  %15 = load i32, ptr %14, align 8, !tbaa !13
  %16 = icmp eq i32 %13, %15
  br i1 %16, label %17, label %21

17:                                               ; preds = %8
  %18 = zext i32 %2 to i64
  %19 = getelementptr inbounds i32, ptr %10, i64 %18
  %20 = load i32, ptr %19, align 4, !tbaa !12
  %.not30 = icmp ugt i32 %20, %13
  br i1 %.not30, label %21, label %22

21:                                               ; preds = %17, %8
  tail call void @__assert_fail(ptr noundef nonnull @.str.29, ptr noundef nonnull @.str.1, i32 noundef 1707, ptr noundef nonnull @__PRETTY_FUNCTION__.removeArc_all_maxtermsender_arcs) #3
  unreachable

22:                                               ; preds = %17
  %23 = getelementptr inbounds i8, ptr %0, i64 312
  %24 = load i32, ptr %23, align 8, !tbaa !14
  %25 = icmp ugt i32 %24, %3
  br i1 %25, label %27, label %26

26:                                               ; preds = %22
  tail call void @__assert_fail(ptr noundef nonnull @.str.30, ptr noundef nonnull @.str.1, i32 noundef 1708, ptr noundef nonnull @__PRETTY_FUNCTION__.removeArc_all_maxtermsender_arcs) #3
  unreachable

27:                                               ; preds = %22
  tail call void @removeArc(ptr noundef nonnull %0, i32 noundef %1, i32 noundef %2)
  %28 = getelementptr inbounds i8, ptr %0, i64 320
  %29 = load ptr, ptr %28, align 8, !tbaa !15
  %30 = zext i32 %3 to i64
  %31 = getelementptr inbounds %struct.nodepair_s, ptr %29, i64 %30
  %32 = load i32, ptr %31, align 4, !tbaa !16
  %33 = icmp eq i32 %32, %1
  br i1 %33, label %34, label %38

34:                                               ; preds = %27
  %35 = getelementptr inbounds i8, ptr %31, i64 4
  %36 = load i32, ptr %35, align 4, !tbaa !18
  %37 = icmp eq i32 %36, %2
  br i1 %37, label %39, label %38

38:                                               ; preds = %34, %27
  tail call void @__assert_fail(ptr noundef nonnull @.str.31, ptr noundef nonnull @.str.1, i32 noundef 1711, ptr noundef nonnull @__PRETTY_FUNCTION__.removeArc_all_maxtermsender_arcs) #3
  unreachable

39:                                               ; preds = %34
  %40 = load i32, ptr %23, align 8, !tbaa !14
  %41 = add i32 %40, -1
  store i32 %41, ptr %23, align 8, !tbaa !14
  %42 = zext i32 %41 to i64
  %43 = getelementptr inbounds %struct.nodepair_s, ptr %29, i64 %42
  %44 = load <2 x i32>, ptr %43, align 4, !tbaa !12
  store <2 x i32> %44, ptr %31, align 4, !tbaa !12
  %45 = shl nuw nsw i64 %42, 3
  %46 = tail call ptr @safe_realloc(ptr noundef nonnull %29, i64 noundef %45) #4
  store ptr %46, ptr %28, align 8, !tbaa !15
  ret void
}

attributes #0 = { noreturn 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 = { "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 = { noreturn nounwind }
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 4}
!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, !10, i64 288}
!12 = !{!7, !7, i64 0}
!13 = !{!6, !7, i64 296}
!14 = !{!6, !7, i64 312}
!15 = !{!6, !10, i64 320}
!16 = !{!17, !7, i64 0}
!17 = !{!"nodepair_s", !7, i64 0, !7, i64 4}
!18 = !{!17, !7, i64 4}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InstCombinePass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass