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

; 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 [15 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [90 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [16 x i8], align 1
@__PRETTY_FUNCTION__.changeLoopInteraction = external hidden unnamed_addr constant [64 x i8], align 1

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

declare i32 @isArc(ptr noundef, i32 noundef, i32 noundef) #1

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

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

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

16:                                               ; preds = %4
  br label %18

17:                                               ; preds = %4
  call void @__assert_fail(ptr noundef @.str, ptr noundef @.str.1, i32 noundef 512, ptr noundef @__PRETTY_FUNCTION__.changeLoopInteraction) #5
  unreachable

18:                                               ; preds = %16
  %19 = load ptr, ptr %5, align 8, !tbaa !5
  %20 = load i32, ptr %6, align 4, !tbaa !9
  %21 = load i32, ptr %7, align 4, !tbaa !9
  %22 = call i32 @isArc(ptr noundef %19, i32 noundef %20, i32 noundef %21)
  %23 = icmp ne i32 %22, 0
  br i1 %23, label %25, label %24

24:                                               ; preds = %18
  br label %26

25:                                               ; preds = %18
  call void @__assert_fail(ptr noundef @.str.2, ptr noundef @.str.1, i32 noundef 513, ptr noundef @__PRETTY_FUNCTION__.changeLoopInteraction) #5
  unreachable

26:                                               ; preds = %24
  %27 = load i32, ptr %6, align 4, !tbaa !9
  %28 = load i32, ptr %7, align 4, !tbaa !9
  %29 = icmp ne i32 %27, %28
  br i1 %29, label %30, label %43

30:                                               ; preds = %26
  %31 = load ptr, ptr %5, align 8, !tbaa !5
  %32 = load i32, ptr %6, align 4, !tbaa !9
  %33 = call i32 @has_loop(ptr noundef %31, i32 noundef %32)
  %34 = icmp ne i32 %33, 0
  br i1 %34, label %35, label %43

35:                                               ; preds = %30
  %36 = load ptr, ptr %5, align 8, !tbaa !5
  %37 = load i32, ptr %7, align 4, !tbaa !9
  %38 = call i32 @has_loop(ptr noundef %36, i32 noundef %37)
  %39 = icmp ne i32 %38, 0
  br i1 %39, label %40, label %43

40:                                               ; preds = %35
  %41 = load i32, ptr %9, align 4, !tbaa !9
  %42 = add i32 %41, 1
  store i32 %42, ptr %9, align 4, !tbaa !9
  br label %115

43:                                               ; preds = %35, %30, %26
  %44 = load i32, ptr %6, align 4, !tbaa !9
  %45 = load i32, ptr %7, align 4, !tbaa !9
  %46 = icmp eq i32 %44, %45
  br i1 %46, label %47, label %114

47:                                               ; preds = %43
  store i32 0, ptr %10, align 4, !tbaa !9
  br label %48

48:                                               ; preds = %77, %47
  %49 = load i32, ptr %10, align 4, !tbaa !9
  %50 = load ptr, ptr %5, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct.graph_s, ptr %50, i32 0, i32 4
  %52 = load ptr, ptr %51, align 8, !tbaa !15
  %53 = load i32, ptr %6, align 4, !tbaa !9
  %54 = zext i32 %53 to i64
  %55 = getelementptr inbounds i32, ptr %52, i64 %54
  %56 = load i32, ptr %55, align 4, !tbaa !9
  %57 = icmp ult i32 %49, %56
  br i1 %57, label %58, label %80

58:                                               ; preds = %48
  %59 = load ptr, ptr %5, align 8, !tbaa !5
  %60 = load ptr, ptr %5, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct.graph_s, ptr %60, i32 0, i32 5
  %62 = load ptr, ptr %61, align 8, !tbaa !16
  %63 = load i32, ptr %6, align 4, !tbaa !9
  %64 = zext i32 %63 to i64
  %65 = getelementptr inbounds ptr, ptr %62, i64 %64
  %66 = load ptr, ptr %65, align 8, !tbaa !5
  %67 = load i32, ptr %10, align 4, !tbaa !9
  %68 = zext i32 %67 to i64
  %69 = getelementptr inbounds i32, ptr %66, i64 %68
  %70 = load i32, ptr %69, align 4, !tbaa !9
  %71 = call i32 @has_loop(ptr noundef %59, i32 noundef %70)
  %72 = icmp ne i32 %71, 0
  br i1 %72, label %73, label %76

73:                                               ; preds = %58
  %74 = load i32, ptr %9, align 4, !tbaa !9
  %75 = add i32 %74, 1
  store i32 %75, ptr %9, align 4, !tbaa !9
  br label %76

76:                                               ; preds = %73, %58
  br label %77

77:                                               ; preds = %76
  %78 = load i32, ptr %10, align 4, !tbaa !9
  %79 = add i32 %78, 1
  store i32 %79, ptr %10, align 4, !tbaa !9
  br label %48, !llvm.loop !17

80:                                               ; preds = %48
  store i32 0, ptr %10, align 4, !tbaa !9
  br label %81

81:                                               ; preds = %110, %80
  %82 = load i32, ptr %10, align 4, !tbaa !9
  %83 = load ptr, ptr %5, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct.graph_s, ptr %83, i32 0, i32 6
  %85 = load ptr, ptr %84, align 8, !tbaa !19
  %86 = load i32, ptr %6, align 4, !tbaa !9
  %87 = zext i32 %86 to i64
  %88 = getelementptr inbounds i32, ptr %85, i64 %87
  %89 = load i32, ptr %88, align 4, !tbaa !9
  %90 = icmp ult i32 %82, %89
  br i1 %90, label %91, label %113

91:                                               ; preds = %81
  %92 = load ptr, ptr %5, align 8, !tbaa !5
  %93 = load ptr, ptr %5, align 8, !tbaa !5
  %94 = getelementptr inbounds %struct.graph_s, ptr %93, i32 0, i32 7
  %95 = load ptr, ptr %94, align 8, !tbaa !20
  %96 = load i32, ptr %6, align 4, !tbaa !9
  %97 = zext i32 %96 to i64
  %98 = getelementptr inbounds ptr, ptr %95, i64 %97
  %99 = load ptr, ptr %98, align 8, !tbaa !5
  %100 = load i32, ptr %10, align 4, !tbaa !9
  %101 = zext i32 %100 to i64
  %102 = getelementptr inbounds i32, ptr %99, i64 %101
  %103 = load i32, ptr %102, align 4, !tbaa !9
  %104 = call i32 @has_loop(ptr noundef %92, i32 noundef %103)
  %105 = icmp ne i32 %104, 0
  br i1 %105, label %106, label %109

106:                                              ; preds = %91
  %107 = load i32, ptr %9, align 4, !tbaa !9
  %108 = add i32 %107, 1
  store i32 %108, ptr %9, align 4, !tbaa !9
  br label %109

109:                                              ; preds = %106, %91
  br label %110

110:                                              ; preds = %109
  %111 = load i32, ptr %10, align 4, !tbaa !9
  %112 = add i32 %111, 1
  store i32 %112, ptr %10, align 4, !tbaa !9
  br label %81, !llvm.loop !21

113:                                              ; preds = %81
  br label %114

114:                                              ; preds = %113, %43
  br label %115

115:                                              ; preds = %114, %40
  %116 = load i32, ptr %9, align 4, !tbaa !9
  %117 = uitofp i32 %116 to double
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  ret double %117
}

declare i32 @has_loop(ptr noundef, i32 noundef) #1

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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 }
attributes #5 = { 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, !12, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = !{!14, !10, i64 4}
!14 = !{!"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}
!15 = !{!14, !6, i64 16}
!16 = !{!14, !6, i64 24}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}
!19 = !{!14, !6, i64 32}
!20 = !{!14, !6, i64 40}
!21 = distinct !{!21, !18}


; 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 [15 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [90 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [16 x i8], align 1
@__PRETTY_FUNCTION__.changeLoopInteraction = external hidden unnamed_addr constant [64 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 @isArc(ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local double @changeLoopInteraction(ptr noundef %0, i32 noundef %1, i32 noundef %2, double 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 512, ptr noundef nonnull @__PRETTY_FUNCTION__.changeLoopInteraction) #3
  unreachable

8:                                                ; preds = %4
  %9 = tail call i32 @isArc(ptr noundef nonnull %0, i32 noundef %1, i32 noundef %2) #4
  %.not37 = icmp eq i32 %9, 0
  br i1 %.not37, label %11, label %10

10:                                               ; preds = %8
  tail call void @__assert_fail(ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.1, i32 noundef 513, ptr noundef nonnull @__PRETTY_FUNCTION__.changeLoopInteraction) #3
  unreachable

11:                                               ; preds = %8
  %.not38 = icmp eq i32 %1, %2
  br i1 %.not38, label %.preheader44, label %18

.preheader44:                                     ; preds = %11
  %12 = getelementptr inbounds i8, ptr %0, i64 16
  %13 = zext i32 %1 to i64
  %14 = load ptr, ptr %12, align 8, !tbaa !11
  %15 = getelementptr inbounds i32, ptr %14, i64 %13
  %16 = load i32, ptr %15, align 4, !tbaa !12
  %.not52 = icmp eq i32 %16, 0
  br i1 %.not52, label %.preheader, label %.lr.ph

.lr.ph:                                           ; preds = %.preheader44
  %17 = getelementptr inbounds i8, ptr %0, i64 24
  br label %27

18:                                               ; preds = %11
  %19 = tail call i32 @has_loop(ptr noundef nonnull %0, i32 noundef %1) #4
  %.not39 = icmp eq i32 %19, 0
  br i1 %.not39, label %.thread, label %20

20:                                               ; preds = %18
  %21 = tail call i32 @has_loop(ptr noundef nonnull %0, i32 noundef %2) #4
  %.not40 = icmp eq i32 %21, 0
  br i1 %.not40, label %.thread, label %.loopexit

.thread:                                          ; preds = %20, %18
  br label %.loopexit

.preheader:                                       ; preds = %27, %.preheader44
  %.032.lcssa = phi i32 [ 0, %.preheader44 ], [ %spec.select, %27 ]
  %22 = getelementptr inbounds i8, ptr %0, i64 32
  %23 = load ptr, ptr %22, align 8, !tbaa !13
  %24 = getelementptr inbounds i32, ptr %23, i64 %13
  %25 = load i32, ptr %24, align 4, !tbaa !12
  %.not53 = icmp eq i32 %25, 0
  br i1 %.not53, label %.loopexit, label %.lr.ph50

.lr.ph50:                                         ; preds = %.preheader
  %26 = getelementptr inbounds i8, ptr %0, i64 40
  br label %40

27:                                               ; preds = %.lr.ph, %27
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %27 ]
  %.03245 = phi i32 [ 0, %.lr.ph ], [ %spec.select, %27 ]
  %28 = load ptr, ptr %17, align 8, !tbaa !14
  %29 = getelementptr inbounds ptr, ptr %28, i64 %13
  %30 = load ptr, ptr %29, align 8, !tbaa !15
  %31 = getelementptr inbounds i32, ptr %30, i64 %indvars.iv
  %32 = load i32, ptr %31, align 4, !tbaa !12
  %33 = tail call i32 @has_loop(ptr noundef nonnull %0, i32 noundef %32) #4
  %.not42 = icmp ne i32 %33, 0
  %34 = zext i1 %.not42 to i32
  %spec.select = add i32 %.03245, %34
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %35 = load ptr, ptr %12, align 8, !tbaa !11
  %36 = getelementptr inbounds i32, ptr %35, i64 %13
  %37 = load i32, ptr %36, align 4, !tbaa !12
  %38 = zext i32 %37 to i64
  %39 = icmp ult i64 %indvars.iv.next, %38
  br i1 %39, label %27, label %.preheader, !llvm.loop !16

40:                                               ; preds = %.lr.ph50, %40
  %indvars.iv55 = phi i64 [ 0, %.lr.ph50 ], [ %indvars.iv.next56, %40 ]
  %.248 = phi i32 [ %.032.lcssa, %.lr.ph50 ], [ %spec.select43, %40 ]
  %41 = load ptr, ptr %26, align 8, !tbaa !18
  %42 = getelementptr inbounds ptr, ptr %41, i64 %13
  %43 = load ptr, ptr %42, align 8, !tbaa !15
  %44 = getelementptr inbounds i32, ptr %43, i64 %indvars.iv55
  %45 = load i32, ptr %44, align 4, !tbaa !12
  %46 = tail call i32 @has_loop(ptr noundef nonnull %0, i32 noundef %45) #4
  %.not41 = icmp ne i32 %46, 0
  %47 = zext i1 %.not41 to i32
  %spec.select43 = add i32 %.248, %47
  %indvars.iv.next56 = add nuw nsw i64 %indvars.iv55, 1
  %48 = load ptr, ptr %22, align 8, !tbaa !13
  %49 = getelementptr inbounds i32, ptr %48, i64 %13
  %50 = load i32, ptr %49, align 4, !tbaa !12
  %51 = zext i32 %50 to i64
  %52 = icmp ult i64 %indvars.iv.next56, %51
  br i1 %52, label %40, label %.loopexit, !llvm.loop !19

.loopexit:                                        ; preds = %40, %.preheader, %.thread, %20
  %.4 = phi i32 [ 1, %20 ], [ 0, %.thread ], [ %.032.lcssa, %.preheader ], [ %spec.select43, %40 ]
  %53 = uitofp i32 %.4 to double
  ret double %53
}

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

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 16}
!12 = !{!7, !7, i64 0}
!13 = !{!6, !10, i64 32}
!14 = !{!6, !10, i64 24}
!15 = !{!10, !10, i64 0}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}
!18 = !{!6, !10, i64 40}
!19 = distinct !{!19, !17}


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