; LLVM IR from jgaeddert/liquid-dsp :: examples (dsssframe64sync_performance_example)

; 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: nounwind uwtable
define dso_local void @frame64_add_noise(ptr noundef %0, i32 noundef %1, float noundef %2) #0 {
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca float, align 4
  %7 = alloca float, align 4
  %8 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store i32 %1, ptr %5, align 4, !tbaa !9
  store float %2, ptr %6, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  %9 = load float, ptr %6, align 4, !tbaa !11
  %10 = fneg float %9
  %11 = fdiv float %10, 2.000000e+01
  %12 = call float @powf(float noundef 1.000000e+01, float noundef %11) #4
  store float %12, ptr %7, align 4, !tbaa !11
  %13 = load float, ptr %7, align 4, !tbaa !11
  %14 = fpext float %13 to double
  %15 = fmul double %14, 0x3FF6A09E667F3BCD
  %16 = fptrunc double %15 to float
  store float %16, ptr %7, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  store i32 0, ptr %8, align 4, !tbaa !9
  br label %17

17:                                               ; preds = %50, %3
  %18 = load i32, ptr %8, align 4, !tbaa !9
  %19 = load i32, ptr %5, align 4, !tbaa !9
  %20 = icmp ult i32 %18, %19
  br i1 %20, label %21, label %53

21:                                               ; preds = %17
  %22 = load float, ptr %7, align 4, !tbaa !11
  %23 = call float (...) @randnf()
  %24 = call float (...) @randnf()
  %25 = fmul float 0.000000e+00, %24
  %26 = fmul float 1.000000e+00, %24
  %27 = fadd float %23, %25
  %28 = fmul float %22, %27
  %29 = fmul float %22, %26
  %30 = fpext float %28 to double
  %31 = fpext float %29 to double
  %32 = fmul double %30, 0x3FE6A09E667F3BCD
  %33 = fmul double %31, 0x3FE6A09E667F3BCD
  %34 = load ptr, ptr %4, align 8, !tbaa !5
  %35 = load i32, ptr %8, align 4, !tbaa !9
  %36 = zext i32 %35 to i64
  %37 = getelementptr inbounds { float, float }, ptr %34, i64 %36
  %38 = getelementptr inbounds { float, float }, ptr %37, i32 0, i32 0
  %39 = load float, ptr %38, align 4
  %40 = getelementptr inbounds { float, float }, ptr %37, i32 0, i32 1
  %41 = load float, ptr %40, align 4
  %42 = fpext float %39 to double
  %43 = fpext float %41 to double
  %44 = fadd double %42, %32
  %45 = fadd double %43, %33
  %46 = fptrunc double %44 to float
  %47 = fptrunc double %45 to float
  %48 = getelementptr inbounds { float, float }, ptr %37, i32 0, i32 0
  %49 = getelementptr inbounds { float, float }, ptr %37, i32 0, i32 1
  store float %46, ptr %48, align 4
  store float %47, ptr %49, align 4
  br label %50

50:                                               ; preds = %21
  %51 = load i32, ptr %8, align 4, !tbaa !9
  %52 = add i32 %51, 1
  store i32 %52, ptr %8, align 4, !tbaa !9
  br label %17, !llvm.loop !13

53:                                               ; preds = %17
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  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: nounwind
declare float @powf(float noundef, float noundef) #2

declare float @randnf(...) #3

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

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 = { 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 }

!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 = !{!"float", !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: nounwind uwtable
define dso_local void @frame64_add_noise(ptr nocapture noundef %0, i32 noundef %1, float noundef %2) local_unnamed_addr #0 {
  %4 = fdiv float %2, -2.000000e+01
  %5 = tail call float @powf(float noundef 1.000000e+01, float noundef %4) #3
  %.not = icmp eq i32 %1, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %3
  %6 = fpext float %5 to double
  %7 = fmul double %6, 0x3FF6A09E667F3BCD
  %8 = fptrunc double %7 to float
  %wide.trip.count = zext i32 %1 to i64
  %9 = insertelement <2 x float> poison, float %8, i64 0
  %10 = shufflevector <2 x float> %9, <2 x float> poison, <2 x i32> zeroinitializer
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader, %.lr.ph
  %indvars.iv = phi i64 [ 0, %.lr.ph.preheader ], [ %indvars.iv.next, %.lr.ph ]
  %11 = tail call float (...) @randnf() #3
  %12 = tail call float (...) @randnf() #3
  %13 = fmul float %12, 0.000000e+00
  %14 = fadd float %11, %13
  %15 = getelementptr inbounds { float, float }, ptr %0, i64 %indvars.iv
  %16 = insertelement <2 x float> poison, float %14, i64 0
  %17 = insertelement <2 x float> %16, float %12, i64 1
  %18 = fmul <2 x float> %17, %10
  %19 = fpext <2 x float> %18 to <2 x double>
  %20 = fmul <2 x double> %19, <double 0x3FE6A09E667F3BCD, double 0x3FE6A09E667F3BCD>
  %21 = load <2 x float>, ptr %15, align 4
  %22 = fpext <2 x float> %21 to <2 x double>
  %23 = fadd <2 x double> %20, %22
  %24 = fptrunc <2 x double> %23 to <2 x float>
  store <2 x float> %24, ptr %15, align 4
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph, !llvm.loop !5

._crit_edge:                                      ; preds = %.lr.ph, %3
  ret void
}

; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare float @powf(float noundef, float noundef) local_unnamed_addr #1

declare float @randnf(...) local_unnamed_addr #2

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 = { 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 #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 = { 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"}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass