; LLVM IR from glaretechnologies/substrata :: opus/opus-1.3.1/silk/float (find_LTP_FLP)

; 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 @silk_find_LTP_FLP(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, i32 noundef %4, i32 noundef %5) #0 {
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca ptr, align 8
  %15 = alloca ptr, align 8
  %16 = alloca ptr, align 8
  %17 = alloca float, align 4
  %18 = alloca float, align 4
  store ptr %0, ptr %7, align 8, !tbaa !5
  store ptr %1, ptr %8, align 8, !tbaa !5
  store ptr %2, ptr %9, align 8, !tbaa !5
  store ptr %3, ptr %10, align 8, !tbaa !5
  store i32 %4, ptr %11, align 4, !tbaa !9
  store i32 %5, ptr %12, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #4
  %19 = load ptr, ptr %8, align 8, !tbaa !5
  store ptr %19, ptr %14, align 8, !tbaa !5
  %20 = load ptr, ptr %7, align 8, !tbaa !5
  store ptr %20, ptr %15, align 8, !tbaa !5
  store i32 0, ptr %13, align 4, !tbaa !9
  br label %21

21:                                               ; preds = %84, %6
  %22 = load i32, ptr %13, align 4, !tbaa !9
  %23 = load i32, ptr %12, align 4, !tbaa !9
  %24 = icmp slt i32 %22, %23
  br i1 %24, label %25, label %87

25:                                               ; preds = %21
  %26 = load ptr, ptr %9, align 8, !tbaa !5
  %27 = load ptr, ptr %10, align 8, !tbaa !5
  %28 = load i32, ptr %13, align 4, !tbaa !9
  %29 = sext i32 %28 to i64
  %30 = getelementptr inbounds i32, ptr %27, i64 %29
  %31 = load i32, ptr %30, align 4, !tbaa !9
  %32 = add nsw i32 %31, 2
  %33 = sext i32 %32 to i64
  %34 = sub i64 0, %33
  %35 = getelementptr inbounds float, ptr %26, i64 %34
  store ptr %35, ptr %16, align 8, !tbaa !5
  %36 = load ptr, ptr %16, align 8, !tbaa !5
  %37 = load i32, ptr %11, align 4, !tbaa !9
  %38 = load ptr, ptr %15, align 8, !tbaa !5
  call void @silk_corrMatrix_FLP(ptr noundef %36, i32 noundef %37, i32 noundef 5, ptr noundef %38)
  %39 = load ptr, ptr %16, align 8, !tbaa !5
  %40 = load ptr, ptr %9, align 8, !tbaa !5
  %41 = load i32, ptr %11, align 4, !tbaa !9
  %42 = load ptr, ptr %14, align 8, !tbaa !5
  call void @silk_corrVector_FLP(ptr noundef %39, ptr noundef %40, i32 noundef %41, i32 noundef 5, ptr noundef %42)
  %43 = load ptr, ptr %9, align 8, !tbaa !5
  %44 = load i32, ptr %11, align 4, !tbaa !9
  %45 = add nsw i32 %44, 5
  %46 = call double @silk_energy_FLP(ptr noundef %43, i32 noundef %45)
  %47 = fptrunc double %46 to float
  store float %47, ptr %17, align 4, !tbaa !11
  %48 = load float, ptr %17, align 4, !tbaa !11
  %49 = load ptr, ptr %15, align 8, !tbaa !5
  %50 = getelementptr inbounds float, ptr %49, i64 0
  %51 = load float, ptr %50, align 4, !tbaa !11
  %52 = load ptr, ptr %15, align 8, !tbaa !5
  %53 = getelementptr inbounds float, ptr %52, i64 24
  %54 = load float, ptr %53, align 4, !tbaa !11
  %55 = fadd float %51, %54
  %56 = call float @llvm.fmuladd.f32(float 0x3F8EB851E0000000, float %55, float 1.000000e+00)
  %57 = fcmp ogt float %48, %56
  br i1 %57, label %58, label %60

58:                                               ; preds = %25
  %59 = load float, ptr %17, align 4, !tbaa !11
  br label %69

60:                                               ; preds = %25
  %61 = load ptr, ptr %15, align 8, !tbaa !5
  %62 = getelementptr inbounds float, ptr %61, i64 0
  %63 = load float, ptr %62, align 4, !tbaa !11
  %64 = load ptr, ptr %15, align 8, !tbaa !5
  %65 = getelementptr inbounds float, ptr %64, i64 24
  %66 = load float, ptr %65, align 4, !tbaa !11
  %67 = fadd float %63, %66
  %68 = call float @llvm.fmuladd.f32(float 0x3F8EB851E0000000, float %67, float 1.000000e+00)
  br label %69

69:                                               ; preds = %60, %58
  %70 = phi float [ %59, %58 ], [ %68, %60 ]
  %71 = fdiv float 1.000000e+00, %70
  store float %71, ptr %18, align 4, !tbaa !11
  %72 = load ptr, ptr %15, align 8, !tbaa !5
  %73 = load float, ptr %18, align 4, !tbaa !11
  call void @silk_scale_vector_FLP(ptr noundef %72, float noundef %73, i32 noundef 25)
  %74 = load ptr, ptr %14, align 8, !tbaa !5
  %75 = load float, ptr %18, align 4, !tbaa !11
  call void @silk_scale_vector_FLP(ptr noundef %74, float noundef %75, i32 noundef 5)
  %76 = load i32, ptr %11, align 4, !tbaa !9
  %77 = load ptr, ptr %9, align 8, !tbaa !5
  %78 = sext i32 %76 to i64
  %79 = getelementptr inbounds float, ptr %77, i64 %78
  store ptr %79, ptr %9, align 8, !tbaa !5
  %80 = load ptr, ptr %15, align 8, !tbaa !5
  %81 = getelementptr inbounds float, ptr %80, i64 25
  store ptr %81, ptr %15, align 8, !tbaa !5
  %82 = load ptr, ptr %14, align 8, !tbaa !5
  %83 = getelementptr inbounds float, ptr %82, i64 5
  store ptr %83, ptr %14, align 8, !tbaa !5
  br label %84

84:                                               ; preds = %69
  %85 = load i32, ptr %13, align 4, !tbaa !9
  %86 = add nsw i32 %85, 1
  store i32 %86, ptr %13, align 4, !tbaa !9
  br label %21, !llvm.loop !13

87:                                               ; preds = %21
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  ret void
}

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

declare void @silk_corrMatrix_FLP(ptr noundef, i32 noundef, i32 noundef, ptr noundef) #2

declare void @silk_corrVector_FLP(ptr noundef, ptr noundef, i32 noundef, i32 noundef, ptr noundef) #2

declare double @silk_energy_FLP(ptr noundef, i32 noundef) #2

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #3

declare void @silk_scale_vector_FLP(ptr noundef, float noundef, i32 noundef) #2

; 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 = { "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 = { 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 @silk_find_LTP_FLP(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr nocapture noundef readonly %3, i32 noundef %4, i32 noundef %5) local_unnamed_addr #0 {
  %7 = icmp sgt i32 %5, 0
  br i1 %7, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %6
  %8 = add nsw i32 %4, 5
  %9 = sext i32 %4 to i64
  %wide.trip.count = zext nneg i32 %5 to i64
  br label %10

10:                                               ; preds = %.lr.ph, %10
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %10 ]
  %.038 = phi ptr [ %2, %.lr.ph ], [ %24, %10 ]
  %.03136 = phi ptr [ %1, %.lr.ph ], [ %26, %10 ]
  %.03235 = phi ptr [ %0, %.lr.ph ], [ %25, %10 ]
  %11 = getelementptr inbounds i32, ptr %3, i64 %indvars.iv
  %12 = load i32, ptr %11, align 4, !tbaa !5
  %narrow = sub nsw i32 -2, %12
  %13 = sext i32 %narrow to i64
  %14 = getelementptr inbounds float, ptr %.038, i64 %13
  tail call void @silk_corrMatrix_FLP(ptr noundef %14, i32 noundef %4, i32 noundef 5, ptr noundef %.03235) #3
  tail call void @silk_corrVector_FLP(ptr noundef %14, ptr noundef %.038, i32 noundef %4, i32 noundef 5, ptr noundef %.03136) #3
  %15 = tail call double @silk_energy_FLP(ptr noundef %.038, i32 noundef %8) #3
  %16 = fptrunc double %15 to float
  %17 = load float, ptr %.03235, align 4, !tbaa !9
  %18 = getelementptr inbounds i8, ptr %.03235, i64 96
  %19 = load float, ptr %18, align 4, !tbaa !9
  %20 = fadd float %17, %19
  %21 = tail call float @llvm.fmuladd.f32(float %20, float 0x3F8EB851E0000000, float 1.000000e+00)
  %22 = fcmp olt float %21, %16
  %. = select i1 %22, float %16, float %21
  %23 = fdiv float 1.000000e+00, %.
  tail call void @silk_scale_vector_FLP(ptr noundef nonnull %.03235, float noundef %23, i32 noundef 25) #3
  tail call void @silk_scale_vector_FLP(ptr noundef %.03136, float noundef %23, i32 noundef 5) #3
  %24 = getelementptr inbounds float, ptr %.038, i64 %9
  %25 = getelementptr inbounds i8, ptr %.03235, i64 100
  %26 = getelementptr inbounds i8, ptr %.03136, i64 20
  %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 %10, !llvm.loop !11

._crit_edge:                                      ; preds = %10, %6
  ret void
}

declare void @silk_corrMatrix_FLP(ptr noundef, i32 noundef, i32 noundef, ptr noundef) local_unnamed_addr #1

declare void @silk_corrVector_FLP(ptr noundef, ptr noundef, i32 noundef, i32 noundef, ptr noundef) local_unnamed_addr #1

declare double @silk_energy_FLP(ptr noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #2

declare void @silk_scale_vector_FLP(ptr noundef, float noundef, i32 noundef) local_unnamed_addr #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 = { "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 = { 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"float", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass