; LLVM IR from modlfo/AudioEngine :: AudioEngine/JuceLibraryCode/juce_audio_basics.ll (ZN4juce21FloatVectorOperations4fillEPddi)

; 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: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden noundef zeroext i1 @_ZN4juce18FloatVectorHelpersL9isAlignedEPKv(ptr noundef) #1

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN4juce21FloatVectorOperations4fillEPddi(ptr noundef %0, double noundef %1, i32 noundef %2) #2 align 2 {
  %4 = alloca ptr, align 8
  %5 = alloca double, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca <2 x double>, align 16
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store double %1, ptr %5, align 8, !tbaa !9
  store i32 %2, ptr %6, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  %13 = load i32, ptr %6, align 4, !tbaa !11
  %14 = sdiv i32 %13, 2
  store i32 %14, ptr %7, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 16, ptr %8) #4
  %15 = load double, ptr %5, align 8, !tbaa !9
  %16 = call noundef <2 x double> @_ZN4juce18FloatVectorHelpers10BasicOps645load1Ed(double noundef %15) #4
  store <2 x double> %16, ptr %8, align 16, !tbaa !13
  %17 = load ptr, ptr %4, align 8, !tbaa !5
  %18 = call noundef zeroext i1 @_ZN4juce18FloatVectorHelpersL9isAlignedEPKv(ptr noundef %17) #4
  br i1 %18, label %19, label %34

19:                                               ; preds = %3
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  store i32 0, ptr %9, align 4, !tbaa !11
  br label %20

20:                                               ; preds = %30, %19
  %21 = load i32, ptr %9, align 4, !tbaa !11
  %22 = load i32, ptr %7, align 4, !tbaa !11
  %23 = icmp slt i32 %21, %22
  br i1 %23, label %25, label %24

24:                                               ; preds = %20
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  br label %33

25:                                               ; preds = %20
  %26 = load ptr, ptr %4, align 8, !tbaa !5
  %27 = load <2 x double>, ptr %8, align 16, !tbaa !13
  call void @_ZN4juce18FloatVectorHelpers10BasicOps646storeAEPdDv2_d(ptr noundef %26, <2 x double> noundef %27) #4
  %28 = load ptr, ptr %4, align 8, !tbaa !5
  %29 = getelementptr inbounds double, ptr %28, i64 2
  store ptr %29, ptr %4, align 8, !tbaa !5
  br label %30

30:                                               ; preds = %25
  %31 = load i32, ptr %9, align 4, !tbaa !11
  %32 = add nsw i32 %31, 1
  store i32 %32, ptr %9, align 4, !tbaa !11
  br label %20, !llvm.loop !14

33:                                               ; preds = %24
  br label %49

34:                                               ; preds = %3
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  store i32 0, ptr %10, align 4, !tbaa !11
  br label %35

35:                                               ; preds = %45, %34
  %36 = load i32, ptr %10, align 4, !tbaa !11
  %37 = load i32, ptr %7, align 4, !tbaa !11
  %38 = icmp slt i32 %36, %37
  br i1 %38, label %40, label %39

39:                                               ; preds = %35
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  br label %48

40:                                               ; preds = %35
  %41 = load ptr, ptr %4, align 8, !tbaa !5
  %42 = load <2 x double>, ptr %8, align 16, !tbaa !13
  call void @_ZN4juce18FloatVectorHelpers10BasicOps646storeUEPdDv2_d(ptr noundef %41, <2 x double> noundef %42) #4
  %43 = load ptr, ptr %4, align 8, !tbaa !5
  %44 = getelementptr inbounds double, ptr %43, i64 2
  store ptr %44, ptr %4, align 8, !tbaa !5
  br label %45

45:                                               ; preds = %40
  %46 = load i32, ptr %10, align 4, !tbaa !11
  %47 = add nsw i32 %46, 1
  store i32 %47, ptr %10, align 4, !tbaa !11
  br label %35, !llvm.loop !16

48:                                               ; preds = %39
  br label %49

49:                                               ; preds = %48, %33
  %50 = load i32, ptr %6, align 4, !tbaa !11
  %51 = and i32 %50, 1
  store i32 %51, ptr %6, align 4, !tbaa !11
  %52 = load i32, ptr %6, align 4, !tbaa !11
  %53 = icmp eq i32 %52, 0
  br i1 %53, label %54, label %55

54:                                               ; preds = %49
  store i32 1, ptr %11, align 4
  br label %56

55:                                               ; preds = %49
  store i32 0, ptr %11, align 4
  br label %56

56:                                               ; preds = %55, %54
  call void @llvm.lifetime.end.p0(i64 16, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  %57 = load i32, ptr %11, align 4
  switch i32 %57, label %74 [
    i32 0, label %58
    i32 1, label %73
  ]

58:                                               ; preds = %56
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #4
  store i32 0, ptr %12, align 4, !tbaa !11
  br label %59

59:                                               ; preds = %70, %58
  %60 = load i32, ptr %12, align 4, !tbaa !11
  %61 = load i32, ptr %6, align 4, !tbaa !11
  %62 = icmp slt i32 %60, %61
  br i1 %62, label %64, label %63

63:                                               ; preds = %59
  store i32 8, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  br label %73

64:                                               ; preds = %59
  %65 = load double, ptr %5, align 8, !tbaa !9
  %66 = load ptr, ptr %4, align 8, !tbaa !5
  %67 = load i32, ptr %12, align 4, !tbaa !11
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds double, ptr %66, i64 %68
  store double %65, ptr %69, align 8, !tbaa !9
  br label %70

70:                                               ; preds = %64
  %71 = load i32, ptr %12, align 4, !tbaa !11
  %72 = add nsw i32 %71, 1
  store i32 %72, ptr %12, align 4, !tbaa !11
  br label %59, !llvm.loop !17

73:                                               ; preds = %63, %56
  ret void

74:                                               ; preds = %56
  unreachable
}

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local noundef <2 x double> @_ZN4juce18FloatVectorHelpers10BasicOps645load1Ed(double noundef) #3 align 2

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local void @_ZN4juce18FloatVectorHelpers10BasicOps646storeAEPdDv2_d(ptr noundef, <2 x double> noundef) #3 align 2

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local void @_ZN4juce18FloatVectorHelpers10BasicOps646storeUEPdDv2_d(ptr noundef, <2 x double> noundef) #3 align 2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { inlinehint 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 nounwind uwtable "min-legal-vector-width"="128" "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 = { alwaysinline mustprogress nounwind uwtable "min-legal-vector-width"="128" "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 }

!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 = !{!7, !7, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = distinct !{!16, !15}
!17 = distinct !{!17, !15}


; 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: inlinehint mustprogress nounwind uwtable
declare hidden noundef zeroext i1 @_ZN4juce18FloatVectorHelpersL9isAlignedEPKv(ptr noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN4juce21FloatVectorOperations4fillEPddi(ptr noundef %0, double noundef %1, i32 noundef %2) local_unnamed_addr #1 align 2 {
  %4 = sdiv i32 %2, 2
  %5 = tail call noundef <2 x double> @_ZN4juce18FloatVectorHelpers10BasicOps645load1Ed(double noundef %1) #3
  %6 = tail call noundef zeroext i1 @_ZN4juce18FloatVectorHelpersL9isAlignedEPKv(ptr noundef %0) #3
  %7 = icmp sgt i32 %2, 1
  br i1 %6, label %.preheader27, label %.preheader29

.preheader29:                                     ; preds = %3
  br i1 %7, label %.lr.ph, label %.loopexit28

.preheader27:                                     ; preds = %3
  br i1 %7, label %.lr.ph35, label %.loopexit28

.lr.ph35:                                         ; preds = %.preheader27, %.lr.ph35
  %.02534 = phi i32 [ %9, %.lr.ph35 ], [ 0, %.preheader27 ]
  %.02633 = phi ptr [ %8, %.lr.ph35 ], [ %0, %.preheader27 ]
  tail call void @_ZN4juce18FloatVectorHelpers10BasicOps646storeAEPdDv2_d(ptr noundef %.02633, <2 x double> noundef %5) #3
  %8 = getelementptr inbounds i8, ptr %.02633, i64 16
  %9 = add nuw nsw i32 %.02534, 1
  %exitcond39.not = icmp eq i32 %9, %4
  br i1 %exitcond39.not, label %.loopexit28, label %.lr.ph35, !llvm.loop !5

.lr.ph:                                           ; preds = %.preheader29, %.lr.ph
  %.02432 = phi i32 [ %11, %.lr.ph ], [ 0, %.preheader29 ]
  %.131 = phi ptr [ %10, %.lr.ph ], [ %0, %.preheader29 ]
  tail call void @_ZN4juce18FloatVectorHelpers10BasicOps646storeUEPdDv2_d(ptr noundef %.131, <2 x double> noundef %5) #3
  %10 = getelementptr inbounds i8, ptr %.131, i64 16
  %11 = add nuw nsw i32 %.02432, 1
  %exitcond.not = icmp eq i32 %11, %4
  br i1 %exitcond.not, label %.loopexit28, label %.lr.ph, !llvm.loop !7

.loopexit28:                                      ; preds = %.lr.ph, %.lr.ph35, %.preheader29, %.preheader27
  %.2 = phi ptr [ %0, %.preheader27 ], [ %0, %.preheader29 ], [ %8, %.lr.ph35 ], [ %10, %.lr.ph ]
  %12 = and i32 %2, 1
  %.not = icmp eq i32 %12, 0
  br i1 %.not, label %.loopexit, label %.preheader

.preheader:                                       ; preds = %.loopexit28
  store double %1, ptr %.2, align 8, !tbaa !8
  br label %.loopexit

.loopexit:                                        ; preds = %.preheader, %.loopexit28
  ret void
}

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local noundef <2 x double> @_ZN4juce18FloatVectorHelpers10BasicOps645load1Ed(double noundef) local_unnamed_addr #2 align 2

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local void @_ZN4juce18FloatVectorHelpers10BasicOps646storeAEPdDv2_d(ptr noundef, <2 x double> noundef) local_unnamed_addr #2 align 2

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local void @_ZN4juce18FloatVectorHelpers10BasicOps646storeUEPdDv2_d(ptr noundef, <2 x double> noundef) local_unnamed_addr #2 align 2

attributes #0 = { inlinehint 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 #1 = { mustprogress nounwind uwtable "min-legal-vector-width"="128" "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 = { alwaysinline mustprogress nounwind uwtable "min-legal-vector-width"="128" "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 }

!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"}
!7 = distinct !{!7, !6}
!8 = !{!9, !9, i64 0}
!9 = !{!"double", !10, i64 0}
!10 = !{!"omnipotent char", !11, i64 0}
!11 = !{!"Simple C++ TBAA"}


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