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

; 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: alwaysinline mustprogress nounwind uwtable
declare dso_local noundef <2 x double> @_ZN4juce18FloatVectorHelpers10BasicOps645load1Ed(double noundef) #2 align 2

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

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

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

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

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

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

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

26:                                               ; preds = %22
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  br label %39

27:                                               ; preds = %22
  call void @llvm.lifetime.start.p0(i64 16, ptr %10) #4
  %28 = load ptr, ptr %4, align 8, !tbaa !5
  %29 = call noundef <2 x double> @_ZN4juce18FloatVectorHelpers10BasicOps645loadAEPKd(ptr noundef %28) #4
  store <2 x double> %29, ptr %10, align 16, !tbaa !13
  %30 = load ptr, ptr %4, align 8, !tbaa !5
  %31 = load <2 x double>, ptr %10, align 16, !tbaa !13
  %32 = load <2 x double>, ptr %8, align 16, !tbaa !13
  %33 = call noundef <2 x double> @_ZN4juce18FloatVectorHelpers10BasicOps643addEDv2_dS2_(<2 x double> noundef %31, <2 x double> noundef %32) #4
  call void @_ZN4juce18FloatVectorHelpers10BasicOps646storeAEPdDv2_d(ptr noundef %30, <2 x double> noundef %33) #4
  %34 = load ptr, ptr %4, align 8, !tbaa !5
  %35 = getelementptr inbounds double, ptr %34, i64 2
  store ptr %35, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 16, ptr %10) #4
  br label %36

36:                                               ; preds = %27
  %37 = load i32, ptr %9, align 4, !tbaa !11
  %38 = add nsw i32 %37, 1
  store i32 %38, ptr %9, align 4, !tbaa !11
  br label %22, !llvm.loop !14

39:                                               ; preds = %26
  br label %59

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

41:                                               ; preds = %55, %40
  %42 = load i32, ptr %11, align 4, !tbaa !11
  %43 = load i32, ptr %7, align 4, !tbaa !11
  %44 = icmp slt i32 %42, %43
  br i1 %44, label %46, label %45

45:                                               ; preds = %41
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  br label %58

46:                                               ; preds = %41
  call void @llvm.lifetime.start.p0(i64 16, ptr %12) #4
  %47 = load ptr, ptr %4, align 8, !tbaa !5
  %48 = call noundef <2 x double> @_ZN4juce18FloatVectorHelpers10BasicOps645loadUEPKd(ptr noundef %47) #4
  store <2 x double> %48, ptr %12, align 16, !tbaa !13
  %49 = load ptr, ptr %4, align 8, !tbaa !5
  %50 = load <2 x double>, ptr %12, align 16, !tbaa !13
  %51 = load <2 x double>, ptr %8, align 16, !tbaa !13
  %52 = call noundef <2 x double> @_ZN4juce18FloatVectorHelpers10BasicOps643addEDv2_dS2_(<2 x double> noundef %50, <2 x double> noundef %51) #4
  call void @_ZN4juce18FloatVectorHelpers10BasicOps646storeUEPdDv2_d(ptr noundef %49, <2 x double> noundef %52) #4
  %53 = load ptr, ptr %4, align 8, !tbaa !5
  %54 = getelementptr inbounds double, ptr %53, i64 2
  store ptr %54, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 16, ptr %12) #4
  br label %55

55:                                               ; preds = %46
  %56 = load i32, ptr %11, align 4, !tbaa !11
  %57 = add nsw i32 %56, 1
  store i32 %57, ptr %11, align 4, !tbaa !11
  br label %41, !llvm.loop !16

58:                                               ; preds = %45
  br label %59

59:                                               ; preds = %58, %39
  %60 = load i32, ptr %6, align 4, !tbaa !11
  %61 = and i32 %60, 1
  store i32 %61, ptr %6, align 4, !tbaa !11
  %62 = load i32, ptr %6, align 4, !tbaa !11
  %63 = icmp eq i32 %62, 0
  br i1 %63, label %64, label %65

64:                                               ; preds = %59
  store i32 1, ptr %13, align 4
  br label %66

65:                                               ; preds = %59
  store i32 0, ptr %13, align 4
  br label %66

66:                                               ; preds = %65, %64
  call void @llvm.lifetime.end.p0(i64 16, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  %67 = load i32, ptr %13, align 4
  switch i32 %67, label %86 [
    i32 0, label %68
    i32 1, label %85
  ]

68:                                               ; preds = %66
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #4
  store i32 0, ptr %14, align 4, !tbaa !11
  br label %69

69:                                               ; preds = %82, %68
  %70 = load i32, ptr %14, align 4, !tbaa !11
  %71 = load i32, ptr %6, align 4, !tbaa !11
  %72 = icmp slt i32 %70, %71
  br i1 %72, label %74, label %73

73:                                               ; preds = %69
  store i32 8, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #4
  br label %85

74:                                               ; preds = %69
  %75 = load double, ptr %5, align 8, !tbaa !9
  %76 = load ptr, ptr %4, align 8, !tbaa !5
  %77 = load i32, ptr %14, align 4, !tbaa !11
  %78 = sext i32 %77 to i64
  %79 = getelementptr inbounds double, ptr %76, i64 %78
  %80 = load double, ptr %79, align 8, !tbaa !9
  %81 = fadd double %80, %75
  store double %81, ptr %79, align 8, !tbaa !9
  br label %82

82:                                               ; preds = %74
  %83 = load i32, ptr %14, align 4, !tbaa !11
  %84 = add nsw i32 %83, 1
  store i32 %84, ptr %14, align 4, !tbaa !11
  br label %69, !llvm.loop !17

85:                                               ; preds = %73, %66
  ret void

86:                                               ; preds = %66
  unreachable
}

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local noundef <2 x double> @_ZN4juce18FloatVectorHelpers10BasicOps643addEDv2_dS2_(<2 x double> noundef, <2 x double> noundef) #2 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 = { 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 = { 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: alwaysinline mustprogress nounwind uwtable
declare dso_local noundef <2 x double> @_ZN4juce18FloatVectorHelpers10BasicOps645load1Ed(double noundef) local_unnamed_addr #1 align 2

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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN4juce21FloatVectorOperations3addEPddi(ptr noundef %0, double noundef %1, i32 noundef %2) local_unnamed_addr #2 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 %.preheader31, label %.preheader33

.preheader33:                                     ; preds = %3
  br i1 %7, label %.lr.ph, label %.loopexit32

.preheader31:                                     ; preds = %3
  br i1 %7, label %.lr.ph39, label %.loopexit32

.lr.ph39:                                         ; preds = %.preheader31, %.lr.ph39
  %.02838 = phi ptr [ %10, %.lr.ph39 ], [ %0, %.preheader31 ]
  %.03037 = phi i32 [ %11, %.lr.ph39 ], [ 0, %.preheader31 ]
  %8 = tail call noundef <2 x double> @_ZN4juce18FloatVectorHelpers10BasicOps645loadAEPKd(ptr noundef %.02838) #3
  %9 = tail call noundef <2 x double> @_ZN4juce18FloatVectorHelpers10BasicOps643addEDv2_dS2_(<2 x double> noundef %8, <2 x double> noundef %5) #3
  tail call void @_ZN4juce18FloatVectorHelpers10BasicOps646storeAEPdDv2_d(ptr noundef %.02838, <2 x double> noundef %9) #3
  %10 = getelementptr inbounds i8, ptr %.02838, i64 16
  %11 = add nuw nsw i32 %.03037, 1
  %exitcond43.not = icmp eq i32 %11, %4
  br i1 %exitcond43.not, label %.loopexit32, label %.lr.ph39, !llvm.loop !5

.lr.ph:                                           ; preds = %.preheader33, %.lr.ph
  %.136 = phi ptr [ %14, %.lr.ph ], [ %0, %.preheader33 ]
  %.02935 = phi i32 [ %15, %.lr.ph ], [ 0, %.preheader33 ]
  %12 = tail call noundef <2 x double> @_ZN4juce18FloatVectorHelpers10BasicOps645loadUEPKd(ptr noundef %.136) #3
  %13 = tail call noundef <2 x double> @_ZN4juce18FloatVectorHelpers10BasicOps643addEDv2_dS2_(<2 x double> noundef %12, <2 x double> noundef %5) #3
  tail call void @_ZN4juce18FloatVectorHelpers10BasicOps646storeUEPdDv2_d(ptr noundef %.136, <2 x double> noundef %13) #3
  %14 = getelementptr inbounds i8, ptr %.136, i64 16
  %15 = add nuw nsw i32 %.02935, 1
  %exitcond.not = icmp eq i32 %15, %4
  br i1 %exitcond.not, label %.loopexit32, label %.lr.ph, !llvm.loop !7

.loopexit32:                                      ; preds = %.lr.ph, %.lr.ph39, %.preheader33, %.preheader31
  %.2 = phi ptr [ %0, %.preheader31 ], [ %0, %.preheader33 ], [ %10, %.lr.ph39 ], [ %14, %.lr.ph ]
  %16 = and i32 %2, 1
  %.not = icmp eq i32 %16, 0
  br i1 %.not, label %18, label %.preheader.split

.preheader.split:                                 ; preds = %.loopexit32
  %.2.promoted = load double, ptr %.2, align 8, !tbaa !8
  %17 = fadd double %.2.promoted, %1
  store double %17, ptr %.2, align 8, !tbaa !8
  br label %18

18:                                               ; preds = %.preheader.split, %.loopexit32
  ret void
}

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local noundef <2 x double> @_ZN4juce18FloatVectorHelpers10BasicOps643addEDv2_dS2_(<2 x double> noundef, <2 x double> noundef) local_unnamed_addr #1 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 = { 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 #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 = { 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,ReassociatePass,SCCPPass,SROAPass,SimplifyCFGPass,TailCallElimPass