; LLVM IR from stivalaa/EstimNetDirected :: Test/TestChangeStatsBipartite (bipartiteStats)

; 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 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [106 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [36 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [36 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [13 x i8], align 1
@__PRETTY_FUNCTION__.BipartiteAltKCyclesA = external hidden unnamed_addr constant [53 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: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #1

declare i32 @bipartite_node_mode(ptr noundef, i32 noundef) #2

declare i32 @twoPaths(ptr noundef, i32 noundef, i32 noundef) #2

; 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 double @BipartiteAltKCyclesA(ptr noundef %0, double noundef %1) #3 {
  %3 = alloca ptr, align 8
  %4 = alloca double, align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca double, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store double %1, ptr %4, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  store double 0.000000e+00, ptr %7, align 8, !tbaa !9
  %8 = load double, ptr %4, align 8, !tbaa !9
  %9 = fcmp ogt double %8, 1.000000e+00
  br i1 %9, label %10, label %11

10:                                               ; preds = %2
  br label %12

11:                                               ; preds = %2
  call void @__assert_fail(ptr noundef @.str.8, ptr noundef @.str.1, i32 noundef 274, ptr noundef @__PRETTY_FUNCTION__.BipartiteAltKCyclesA) #6
  unreachable

12:                                               ; preds = %10
  %13 = load ptr, ptr %3, align 8, !tbaa !5
  %14 = getelementptr inbounds %struct.graph_s, ptr %13, i32 0, i32 2
  %15 = load i32, ptr %14, align 8, !tbaa !11
  %16 = icmp ne i32 %15, 0
  br i1 %16, label %17, label %18

17:                                               ; preds = %12
  br label %19

18:                                               ; preds = %12
  call void @__assert_fail(ptr noundef @.str, ptr noundef @.str.1, i32 noundef 276, ptr noundef @__PRETTY_FUNCTION__.BipartiteAltKCyclesA) #6
  unreachable

19:                                               ; preds = %17
  %20 = load ptr, ptr %3, align 8, !tbaa !5
  %21 = getelementptr inbounds %struct.graph_s, ptr %20, i32 0, i32 1
  %22 = load i32, ptr %21, align 4, !tbaa !14
  %23 = icmp ne i32 %22, 0
  br i1 %23, label %25, label %24

24:                                               ; preds = %19
  br label %26

25:                                               ; preds = %19
  call void @__assert_fail(ptr noundef @.str.2, ptr noundef @.str.1, i32 noundef 277, ptr noundef @__PRETTY_FUNCTION__.BipartiteAltKCyclesA) #6
  unreachable

26:                                               ; preds = %24
  %27 = load ptr, ptr %3, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.graph_s, ptr %27, i32 0, i32 13
  %29 = load i32, ptr %28, align 8, !tbaa !15
  %30 = add i32 %29, 1
  store i32 %30, ptr %6, align 4, !tbaa !16
  br label %31

31:                                               ; preds = %80, %26
  %32 = load i32, ptr %6, align 4, !tbaa !16
  %33 = load ptr, ptr %3, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.graph_s, ptr %33, i32 0, i32 13
  %35 = load i32, ptr %34, align 8, !tbaa !15
  %36 = load ptr, ptr %3, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.graph_s, ptr %36, i32 0, i32 14
  %38 = load i32, ptr %37, align 4, !tbaa !17
  %39 = add i32 %35, %38
  %40 = icmp ult i32 %32, %39
  br i1 %40, label %41, label %83

41:                                               ; preds = %31
  %42 = load ptr, ptr %3, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.graph_s, ptr %42, i32 0, i32 13
  %44 = load i32, ptr %43, align 8, !tbaa !15
  store i32 %44, ptr %5, align 4, !tbaa !16
  br label %45

45:                                               ; preds = %76, %41
  %46 = load i32, ptr %5, align 4, !tbaa !16
  %47 = load i32, ptr %6, align 4, !tbaa !16
  %48 = icmp ult i32 %46, %47
  br i1 %48, label %49, label %79

49:                                               ; preds = %45
  %50 = load ptr, ptr %3, align 8, !tbaa !5
  %51 = load i32, ptr %5, align 4, !tbaa !16
  %52 = call i32 @bipartite_node_mode(ptr noundef %50, i32 noundef %51)
  %53 = icmp eq i32 %52, 1
  br i1 %53, label %54, label %55

54:                                               ; preds = %49
  br label %56

55:                                               ; preds = %49
  call void @__assert_fail(ptr noundef @.str.6, ptr noundef @.str.1, i32 noundef 281, ptr noundef @__PRETTY_FUNCTION__.BipartiteAltKCyclesA) #6
  unreachable

56:                                               ; preds = %54
  %57 = load ptr, ptr %3, align 8, !tbaa !5
  %58 = load i32, ptr %6, align 4, !tbaa !16
  %59 = call i32 @bipartite_node_mode(ptr noundef %57, i32 noundef %58)
  %60 = icmp eq i32 %59, 1
  br i1 %60, label %61, label %62

61:                                               ; preds = %56
  br label %63

62:                                               ; preds = %56
  call void @__assert_fail(ptr noundef @.str.7, ptr noundef @.str.1, i32 noundef 282, ptr noundef @__PRETTY_FUNCTION__.BipartiteAltKCyclesA) #6
  unreachable

63:                                               ; preds = %61
  %64 = load double, ptr %4, align 8, !tbaa !9
  %65 = fdiv double 1.000000e+00, %64
  %66 = fsub double 1.000000e+00, %65
  %67 = load ptr, ptr %3, align 8, !tbaa !5
  %68 = load i32, ptr %5, align 4, !tbaa !16
  %69 = load i32, ptr %6, align 4, !tbaa !16
  %70 = call i32 @twoPaths(ptr noundef %67, i32 noundef %68, i32 noundef %69)
  %71 = uitofp i32 %70 to double
  %72 = call double @pow(double noundef %66, double noundef %71) #5
  %73 = fsub double 1.000000e+00, %72
  %74 = load double, ptr %7, align 8, !tbaa !9
  %75 = fadd double %74, %73
  store double %75, ptr %7, align 8, !tbaa !9
  br label %76

76:                                               ; preds = %63
  %77 = load i32, ptr %5, align 4, !tbaa !16
  %78 = add i32 %77, 1
  store i32 %78, ptr %5, align 4, !tbaa !16
  br label %45, !llvm.loop !18

79:                                               ; preds = %45
  br label %80

80:                                               ; preds = %79
  %81 = load i32, ptr %6, align 4, !tbaa !16
  %82 = add i32 %81, 1
  store i32 %82, ptr %6, align 4, !tbaa !16
  br label %31, !llvm.loop !20

83:                                               ; preds = %31
  %84 = load double, ptr %4, align 8, !tbaa !9
  %85 = load double, ptr %7, align 8, !tbaa !9
  %86 = fmul double %84, %85
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  ret double %86
}

; Function Attrs: nounwind
declare double @pow(double noundef, double noundef) #4

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


; 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 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [106 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [36 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [36 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [13 x i8], align 1
@__PRETTY_FUNCTION__.BipartiteAltKCyclesA = external hidden unnamed_addr constant [53 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 i32 @bipartite_node_mode(ptr noundef, i32 noundef) local_unnamed_addr #1

declare i32 @twoPaths(ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local double @BipartiteAltKCyclesA(ptr noundef %0, double noundef %1) local_unnamed_addr #2 {
  %3 = fcmp ogt double %1, 1.000000e+00
  br i1 %3, label %5, label %4

4:                                                ; preds = %2
  tail call void @__assert_fail(ptr noundef nonnull @.str.8, ptr noundef nonnull @.str.1, i32 noundef 274, ptr noundef nonnull @__PRETTY_FUNCTION__.BipartiteAltKCyclesA) #4
  unreachable

5:                                                ; preds = %2
  %6 = getelementptr inbounds i8, ptr %0, i64 8
  %7 = load i32, ptr %6, align 8, !tbaa !5
  %.not = icmp eq i32 %7, 0
  br i1 %.not, label %8, label %9

8:                                                ; preds = %5
  tail call void @__assert_fail(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 276, ptr noundef nonnull @__PRETTY_FUNCTION__.BipartiteAltKCyclesA) #4
  unreachable

9:                                                ; preds = %5
  %10 = getelementptr inbounds i8, ptr %0, i64 4
  %11 = load i32, ptr %10, align 4, !tbaa !11
  %.not25 = icmp eq i32 %11, 0
  br i1 %.not25, label %13, label %12

12:                                               ; preds = %9
  tail call void @__assert_fail(ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.1, i32 noundef 277, ptr noundef nonnull @__PRETTY_FUNCTION__.BipartiteAltKCyclesA) #4
  unreachable

13:                                               ; preds = %9
  %14 = getelementptr inbounds i8, ptr %0, i64 88
  %15 = load i32, ptr %14, align 8, !tbaa !12
  %16 = getelementptr inbounds i8, ptr %0, i64 92
  %.02232 = add i32 %15, 1
  %17 = load i32, ptr %16, align 4, !tbaa !13
  %18 = add i32 %17, %15
  %19 = icmp ult i32 %.02232, %18
  br i1 %19, label %.preheader.lr.ph, label %._crit_edge

.preheader.lr.ph:                                 ; preds = %13
  %20 = fdiv double 1.000000e+00, %1
  %21 = fsub double 1.000000e+00, %20
  br label %.preheader

.loopexit.loopexit:                               ; preds = %36
  %.pre = load i32, ptr %14, align 8, !tbaa !12
  %.pre36 = load i32, ptr %16, align 4, !tbaa !13
  br label %.loopexit

.loopexit:                                        ; preds = %.loopexit.loopexit, %.preheader
  %22 = phi i32 [ %26, %.preheader ], [ %.pre36, %.loopexit.loopexit ]
  %23 = phi i32 [ %27, %.preheader ], [ %.pre, %.loopexit.loopexit ]
  %.1.lcssa = phi double [ %.033, %.preheader ], [ %41, %.loopexit.loopexit ]
  %.022 = add nuw i32 %.02234, 1
  %24 = add i32 %22, %23
  %25 = icmp ult i32 %.022, %24
  br i1 %25, label %.preheader, label %._crit_edge, !llvm.loop !14

.preheader:                                       ; preds = %.preheader.lr.ph, %.loopexit
  %26 = phi i32 [ %17, %.preheader.lr.ph ], [ %22, %.loopexit ]
  %27 = phi i32 [ %15, %.preheader.lr.ph ], [ %23, %.loopexit ]
  %.02234 = phi i32 [ %.02232, %.preheader.lr.ph ], [ %.022, %.loopexit ]
  %.033 = phi double [ 0.000000e+00, %.preheader.lr.ph ], [ %.1.lcssa, %.loopexit ]
  %28 = icmp ult i32 %27, %.02234
  br i1 %28, label %.lr.ph, label %.loopexit

.lr.ph:                                           ; preds = %.preheader, %36
  %.131 = phi double [ %41, %36 ], [ %.033, %.preheader ]
  %.02330 = phi i32 [ %42, %36 ], [ %27, %.preheader ]
  %29 = tail call i32 @bipartite_node_mode(ptr noundef %0, i32 noundef %.02330) #5
  %30 = icmp eq i32 %29, 1
  br i1 %30, label %32, label %31

31:                                               ; preds = %.lr.ph
  tail call void @__assert_fail(ptr noundef nonnull @.str.6, ptr noundef nonnull @.str.1, i32 noundef 281, ptr noundef nonnull @__PRETTY_FUNCTION__.BipartiteAltKCyclesA) #4
  unreachable

32:                                               ; preds = %.lr.ph
  %33 = tail call i32 @bipartite_node_mode(ptr noundef %0, i32 noundef %.02234) #5
  %34 = icmp eq i32 %33, 1
  br i1 %34, label %36, label %35

35:                                               ; preds = %32
  tail call void @__assert_fail(ptr noundef nonnull @.str.7, ptr noundef nonnull @.str.1, i32 noundef 282, ptr noundef nonnull @__PRETTY_FUNCTION__.BipartiteAltKCyclesA) #4
  unreachable

36:                                               ; preds = %32
  %37 = tail call i32 @twoPaths(ptr noundef %0, i32 noundef %.02330, i32 noundef %.02234) #5
  %38 = uitofp i32 %37 to double
  %39 = tail call double @pow(double noundef %21, double noundef %38) #5
  %40 = fsub double 1.000000e+00, %39
  %41 = fadd double %.131, %40
  %42 = add i32 %.02330, 1
  %exitcond.not = icmp eq i32 %42, %.02234
  br i1 %exitcond.not, label %.loopexit.loopexit, label %.lr.ph, !llvm.loop !16

._crit_edge:                                      ; preds = %.loopexit, %13
  %.0.lcssa = phi double [ 0.000000e+00, %13 ], [ %.1.lcssa, %.loopexit ]
  %43 = fmul double %.0.lcssa, %1
  ret double %43
}

; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @pow(double noundef, double noundef) local_unnamed_addr #3

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 = { mustprogress nofree nounwind willreturn memory(write) "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 #4 = { noreturn nounwind }
attributes #5 = { 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 8}
!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 4}
!12 = !{!6, !7, i64 88}
!13 = !{!6, !7, i64 92}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = distinct !{!16, !15}


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