; LLVM IR from gstonge/spreading_CR :: src (evolution)

; 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"

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3net15infect_fractionERNS_16StaticNetworkSIREdRN10pcg_detail6engineIjmNS2_12xsh_rr_mixinIjmEELb1ENS2_15specific_streamImEENS2_18default_multiplierImEEEERSt25uniform_real_distributionIdE(ptr noundef nonnull align 8 dereferenceable(384) %0, double noundef %1, ptr noundef nonnull align 8 dereferenceable(16) %2, ptr noundef nonnull align 8 dereferenceable(16) %3) #0 {
  %5 = alloca ptr, align 8
  %6 = alloca double, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store double %1, ptr %6, align 8, !tbaa !9
  store ptr %2, ptr %7, align 8, !tbaa !5
  store ptr %3, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  %11 = load ptr, ptr %5, align 8, !tbaa !5
  %12 = call noundef i64 @_ZNK3net7Network4sizeEv(ptr noundef nonnull align 8 dereferenceable(16) %11)
  %13 = uitofp i64 %12 to double
  %14 = load double, ptr %6, align 8, !tbaa !9
  %15 = fmul double %13, %14
  %16 = call double @llvm.floor.f64(double %15)
  %17 = fptoui double %16 to i32
  store i32 %17, ptr %9, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  br label %18

18:                                               ; preds = %40, %4
  %19 = load ptr, ptr %5, align 8, !tbaa !5
  %20 = call noundef i64 @_ZNK3net16StaticNetworkSIR16get_Inode_numberEv(ptr noundef nonnull align 8 dereferenceable(384) %19)
  %21 = load i32, ptr %9, align 4, !tbaa !11
  %22 = zext i32 %21 to i64
  %23 = icmp ult i64 %20, %22
  br i1 %23, label %24, label %41

24:                                               ; preds = %18
  %25 = load ptr, ptr %8, align 8, !tbaa !5
  %26 = load ptr, ptr %7, align 8, !tbaa !5
  %27 = call noundef double @_ZNSt25uniform_real_distributionIdEclIN10pcg_detail6engineIjmNS2_12xsh_rr_mixinIjmEELb1ENS2_15specific_streamImEENS2_18default_multiplierImEEEEEEdRT_(ptr noundef nonnull align 8 dereferenceable(16) %25, ptr noundef nonnull align 8 dereferenceable(16) %26)
  %28 = load ptr, ptr %5, align 8, !tbaa !5
  %29 = call noundef i64 @_ZNK3net7Network4sizeEv(ptr noundef nonnull align 8 dereferenceable(16) %28)
  %30 = uitofp i64 %29 to double
  %31 = fmul double %27, %30
  %32 = call double @llvm.floor.f64(double %31)
  %33 = fptoui double %32 to i32
  store i32 %33, ptr %10, align 4, !tbaa !11
  %34 = load ptr, ptr %5, align 8, !tbaa !5
  %35 = load i32, ptr %10, align 4, !tbaa !11
  %36 = call noundef zeroext i1 @_ZN3net16StaticNetworkSIR14is_susceptibleEj(ptr noundef nonnull align 8 dereferenceable(384) %34, i32 noundef %35)
  br i1 %36, label %37, label %40

37:                                               ; preds = %24
  %38 = load ptr, ptr %5, align 8, !tbaa !5
  %39 = load i32, ptr %10, align 4, !tbaa !11
  call void @_ZN3net16StaticNetworkSIR9infectionEj(ptr noundef nonnull align 8 dereferenceable(384) %38, i32 noundef %39)
  br label %40

40:                                               ; preds = %37, %24
  br label %18, !llvm.loop !13

41:                                               ; preds = %18
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  ret void
}

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNK3net7Network4sizeEv(ptr noundef nonnull align 8 dereferenceable(16)) #2 align 2

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.floor.f64(double) #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNK3net16StaticNetworkSIR16get_Inode_numberEv(ptr noundef nonnull align 8 dereferenceable(384)) #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef double @_ZNSt25uniform_real_distributionIdEclIN10pcg_detail6engineIjmNS2_12xsh_rr_mixinIjmEELb1ENS2_15specific_streamImEENS2_18default_multiplierImEEEEEEdRT_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN3net16StaticNetworkSIR14is_susceptibleEj(ptr noundef nonnull align 8 dereferenceable(384), i32 noundef) #2 align 2

declare void @_ZN3net16StaticNetworkSIR9infectionEj(ptr noundef nonnull align 8 dereferenceable(384), i32 noundef) #4

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

attributes #0 = { mustprogress 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 = { mustprogress 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { "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 }

!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++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"double", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"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"

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3net15infect_fractionERNS_16StaticNetworkSIREdRN10pcg_detail6engineIjmNS2_12xsh_rr_mixinIjmEELb1ENS2_15specific_streamImEENS2_18default_multiplierImEEEERSt25uniform_real_distributionIdE(ptr noundef nonnull align 8 dereferenceable(384) %0, double noundef %1, ptr noundef nonnull align 8 dereferenceable(16) %2, ptr noundef nonnull align 8 dereferenceable(16) %3) local_unnamed_addr #0 {
  %5 = tail call noundef i64 @_ZNK3net7Network4sizeEv(ptr noundef nonnull align 8 dereferenceable(16) %0)
  %6 = uitofp i64 %5 to double
  %7 = fmul double %6, %1
  %8 = tail call double @llvm.floor.f64(double %7)
  %9 = fptoui double %8 to i32
  %10 = tail call noundef i64 @_ZNK3net16StaticNetworkSIR16get_Inode_numberEv(ptr noundef nonnull align 8 dereferenceable(384) %0)
  %11 = zext i32 %9 to i64
  %12 = icmp ult i64 %10, %11
  br i1 %12, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %4, %21
  %13 = tail call noundef double @_ZNSt25uniform_real_distributionIdEclIN10pcg_detail6engineIjmNS2_12xsh_rr_mixinIjmEELb1ENS2_15specific_streamImEENS2_18default_multiplierImEEEEEEdRT_(ptr noundef nonnull align 8 dereferenceable(16) %3, ptr noundef nonnull align 8 dereferenceable(16) %2)
  %14 = tail call noundef i64 @_ZNK3net7Network4sizeEv(ptr noundef nonnull align 8 dereferenceable(16) %0)
  %15 = uitofp i64 %14 to double
  %16 = fmul double %13, %15
  %17 = tail call double @llvm.floor.f64(double %16)
  %18 = fptoui double %17 to i32
  %19 = tail call noundef zeroext i1 @_ZN3net16StaticNetworkSIR14is_susceptibleEj(ptr noundef nonnull align 8 dereferenceable(384) %0, i32 noundef %18)
  br i1 %19, label %20, label %21

20:                                               ; preds = %.lr.ph
  tail call void @_ZN3net16StaticNetworkSIR9infectionEj(ptr noundef nonnull align 8 dereferenceable(384) %0, i32 noundef %18)
  br label %21

21:                                               ; preds = %20, %.lr.ph
  %22 = tail call noundef i64 @_ZNK3net16StaticNetworkSIR16get_Inode_numberEv(ptr noundef nonnull align 8 dereferenceable(384) %0)
  %23 = icmp ult i64 %22, %11
  br i1 %23, label %.lr.ph, label %._crit_edge, !llvm.loop !5

._crit_edge:                                      ; preds = %21, %4
  ret void
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNK3net7Network4sizeEv(ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.floor.f64(double) #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNK3net16StaticNetworkSIR16get_Inode_numberEv(ptr noundef nonnull align 8 dereferenceable(384)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef double @_ZNSt25uniform_real_distributionIdEclIN10pcg_detail6engineIjmNS2_12xsh_rr_mixinIjmEELb1ENS2_15specific_streamImEENS2_18default_multiplierImEEEEEEdRT_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN3net16StaticNetworkSIR14is_susceptibleEj(ptr noundef nonnull align 8 dereferenceable(384), i32 noundef) local_unnamed_addr #1 align 2

declare void @_ZN3net16StaticNetworkSIR9infectionEj(ptr noundef nonnull align 8 dereferenceable(384), i32 noundef) local_unnamed_addr #3

attributes #0 = { mustprogress 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 = { mustprogress 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 #2 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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" }

!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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass