; 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
@__PRETTY_FUNCTION__.PowerFourCyclesA = external hidden unnamed_addr constant [49 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [40 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [42 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local i64 @FourCyclesA(ptr noundef) #0

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

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

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

declare i32 @num_four_cycles_node(ptr noundef, i32 noundef) #3

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

; Function Attrs: nounwind uwtable
define dso_local double @PowerFourCyclesA(ptr noundef %0, double noundef %1) #0 {
  %3 = alloca ptr, align 8
  %4 = alloca double, align 8
  %5 = alloca i32, align 4
  %6 = alloca double, align 8
  %7 = alloca double, align 8
  %8 = alloca i32, align 4
  %9 = alloca i64, align 8
  %10 = alloca i64, align 8
  %11 = alloca i32, align 4
  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 8, ptr %6) #5
  %12 = load double, ptr %4, align 8, !tbaa !9
  %13 = fdiv double 1.000000e+00, %12
  store double %13, ptr %6, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  store double 0.000000e+00, ptr %7, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  store i32 0, ptr %8, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  store i64 0, ptr %9, align 8, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  %14 = load ptr, ptr %3, align 8, !tbaa !5
  %15 = getelementptr inbounds %struct.graph_s, ptr %14, i32 0, i32 2
  %16 = load i32, ptr %15, align 8, !tbaa !15
  %17 = icmp ne i32 %16, 0
  br i1 %17, label %18, label %19

18:                                               ; preds = %2
  br label %20

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

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

25:                                               ; preds = %20
  br label %27

26:                                               ; preds = %20
  call void @__assert_fail(ptr noundef @.str.2, ptr noundef @.str.1, i32 noundef 648, ptr noundef @__PRETTY_FUNCTION__.PowerFourCyclesA) #6
  unreachable

27:                                               ; preds = %25
  store i32 0, ptr %5, align 4, !tbaa !11
  br label %28

28:                                               ; preds = %59, %27
  %29 = load i32, ptr %5, align 4, !tbaa !11
  %30 = load ptr, ptr %3, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.graph_s, ptr %30, i32 0, i32 13
  %32 = load i32, ptr %31, align 8, !tbaa !18
  %33 = icmp ult i32 %29, %32
  br i1 %33, label %34, label %62

34:                                               ; preds = %28
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  %35 = load ptr, ptr %3, align 8, !tbaa !5
  %36 = load i32, ptr %5, align 4, !tbaa !11
  %37 = call i32 @num_four_cycles_node_SLOW(ptr noundef %35, i32 noundef %36)
  store i32 %37, ptr %11, align 4, !tbaa !11
  %38 = load ptr, ptr %3, align 8, !tbaa !5
  %39 = load i32, ptr %5, align 4, !tbaa !11
  %40 = call i32 @num_four_cycles_node(ptr noundef %38, i32 noundef %39)
  store i32 %40, ptr %8, align 4, !tbaa !11
  %41 = load i32, ptr %8, align 4, !tbaa !11
  %42 = load i32, ptr %11, align 4, !tbaa !11
  %43 = icmp eq i32 %41, %42
  br i1 %43, label %44, label %45

44:                                               ; preds = %34
  br label %46

45:                                               ; preds = %34
  call void @__assert_fail(ptr noundef @.str.9, ptr noundef @.str.1, i32 noundef 653, ptr noundef @__PRETTY_FUNCTION__.PowerFourCyclesA) #6
  unreachable

46:                                               ; preds = %44
  %47 = load i32, ptr %8, align 4, !tbaa !11
  %48 = zext i32 %47 to i64
  %49 = load i64, ptr %9, align 8, !tbaa !13
  %50 = add i64 %49, %48
  store i64 %50, ptr %9, align 8, !tbaa !13
  %51 = load ptr, ptr %3, align 8, !tbaa !5
  %52 = load i32, ptr %5, align 4, !tbaa !11
  %53 = call i32 @num_four_cycles_node(ptr noundef %51, i32 noundef %52)
  %54 = uitofp i32 %53 to double
  %55 = load double, ptr %6, align 8, !tbaa !9
  %56 = call double @pow(double noundef %54, double noundef %55) #5
  %57 = load double, ptr %7, align 8, !tbaa !9
  %58 = fadd double %57, %56
  store double %58, ptr %7, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  br label %59

59:                                               ; preds = %46
  %60 = load i32, ptr %5, align 4, !tbaa !11
  %61 = add i32 %60, 1
  store i32 %61, ptr %5, align 4, !tbaa !11
  br label %28, !llvm.loop !19

62:                                               ; preds = %28
  %63 = load i64, ptr %9, align 8, !tbaa !13
  %64 = urem i64 %63, 2
  %65 = icmp eq i64 %64, 0
  br i1 %65, label %66, label %67

66:                                               ; preds = %62
  br label %68

67:                                               ; preds = %62
  call void @__assert_fail(ptr noundef @.str.10, ptr noundef @.str.1, i32 noundef 658, ptr noundef @__PRETTY_FUNCTION__.PowerFourCyclesA) #6
  unreachable

68:                                               ; preds = %66
  %69 = load ptr, ptr %3, align 8, !tbaa !5
  %70 = call i64 @FourCyclesA(ptr noundef %69)
  store i64 %70, ptr %10, align 8, !tbaa !13
  %71 = load i64, ptr %9, align 8, !tbaa !13
  %72 = udiv i64 %71, 2
  %73 = load i64, ptr %10, align 8, !tbaa !13
  %74 = icmp eq i64 %72, %73
  br i1 %74, label %75, label %76

75:                                               ; preds = %68
  br label %77

76:                                               ; preds = %68
  call void @__assert_fail(ptr noundef @.str.11, ptr noundef @.str.1, i32 noundef 660, ptr noundef @__PRETTY_FUNCTION__.PowerFourCyclesA) #6
  unreachable

77:                                               ; preds = %75
  %78 = load double, ptr %7, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  ret double %78
}

; Function Attrs: nounwind uwtable
declare hidden i32 @num_four_cycles_node_SLOW(ptr noundef, i32 noundef) #0

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


; 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
@__PRETTY_FUNCTION__.PowerFourCyclesA = external hidden unnamed_addr constant [49 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [40 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [42 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local i64 @FourCyclesA(ptr noundef) local_unnamed_addr #0

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

declare i32 @num_four_cycles_node(ptr noundef, i32 noundef) local_unnamed_addr #2

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

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

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

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

.preheader:                                       ; preds = %7
  %10 = getelementptr inbounds i8, ptr %0, i64 88
  %11 = load i32, ptr %10, align 8, !tbaa !12
  %.not32 = icmp eq i32 %11, 0
  br i1 %.not32, label %._crit_edge.thread, label %.lr.ph

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

.lr.ph:                                           ; preds = %.preheader, %17
  %.030 = phi i32 [ %24, %17 ], [ 0, %.preheader ]
  %.02229 = phi double [ %23, %17 ], [ 0.000000e+00, %.preheader ]
  %.02328 = phi i64 [ %19, %17 ], [ 0, %.preheader ]
  %13 = tail call i32 @num_four_cycles_node_SLOW(ptr noundef nonnull %0, i32 noundef %.030)
  %14 = tail call i32 @num_four_cycles_node(ptr noundef nonnull %0, i32 noundef %.030) #5
  %15 = icmp eq i32 %14, %13
  br i1 %15, label %17, label %16

16:                                               ; preds = %.lr.ph
  tail call void @__assert_fail(ptr noundef nonnull @.str.9, ptr noundef nonnull @.str.1, i32 noundef 653, ptr noundef nonnull @__PRETTY_FUNCTION__.PowerFourCyclesA) #4
  unreachable

17:                                               ; preds = %.lr.ph
  %18 = zext i32 %13 to i64
  %19 = add i64 %.02328, %18
  %20 = tail call i32 @num_four_cycles_node(ptr noundef nonnull %0, i32 noundef %.030) #5
  %21 = uitofp i32 %20 to double
  %22 = tail call double @pow(double noundef %21, double noundef %3) #5
  %23 = fadd double %.02229, %22
  %24 = add nuw i32 %.030, 1
  %25 = load i32, ptr %10, align 8, !tbaa !12
  %26 = icmp ult i32 %24, %25
  br i1 %26, label %.lr.ph, label %._crit_edge, !llvm.loop !13

._crit_edge:                                      ; preds = %17
  %27 = and i64 %19, 1
  %28 = icmp eq i64 %27, 0
  br i1 %28, label %._crit_edge.thread, label %29

29:                                               ; preds = %._crit_edge
  tail call void @__assert_fail(ptr noundef nonnull @.str.10, ptr noundef nonnull @.str.1, i32 noundef 658, ptr noundef nonnull @__PRETTY_FUNCTION__.PowerFourCyclesA) #4
  unreachable

._crit_edge.thread:                               ; preds = %.preheader, %._crit_edge
  %.022.lcssa37 = phi double [ %23, %._crit_edge ], [ 0.000000e+00, %.preheader ]
  %.023.lcssa36 = phi i64 [ %19, %._crit_edge ], [ 0, %.preheader ]
  %30 = tail call i64 @FourCyclesA(ptr noundef nonnull %0)
  %31 = lshr exact i64 %.023.lcssa36, 1
  %32 = icmp eq i64 %31, %30
  br i1 %32, label %34, label %33

33:                                               ; preds = %._crit_edge.thread
  tail call void @__assert_fail(ptr noundef nonnull @.str.11, ptr noundef nonnull @.str.1, i32 noundef 660, ptr noundef nonnull @__PRETTY_FUNCTION__.PowerFourCyclesA) #4
  unreachable

34:                                               ; preds = %._crit_edge.thread
  ret double %.022.lcssa37
}

; Function Attrs: nounwind uwtable
declare hidden i32 @num_four_cycles_node_SLOW(ptr noundef, i32 noundef) local_unnamed_addr #0

attributes #0 = { 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 = { 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 = { 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 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}


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