; LLVM IR from ange-yaghi/engine-sim :: src/feedback_comb_filter.ll (ZN18FeedbackCombFilter1fEf)

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

%class.FeedbackCombFilter = type { %class.Filter, float, ptr, i32, i32 }
%class.Filter = type { ptr }

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef float @_ZN18FeedbackCombFilter1fEf(ptr noundef nonnull align 8 dereferenceable(32) %0, float noundef %1) unnamed_addr #0 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca float, align 4
  %5 = alloca float, align 4
  %6 = alloca float, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store float %1, ptr %4, align 4, !tbaa !9
  %7 = load ptr, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #3
  %8 = getelementptr inbounds %class.FeedbackCombFilter, ptr %7, i32 0, i32 2
  %9 = load ptr, ptr %8, align 8, !tbaa !11
  %10 = getelementptr inbounds %class.FeedbackCombFilter, ptr %7, i32 0, i32 3
  %11 = load i32, ptr %10, align 8, !tbaa !15
  %12 = sext i32 %11 to i64
  %13 = getelementptr inbounds float, ptr %9, i64 %12
  %14 = load float, ptr %13, align 4, !tbaa !9
  store float %14, ptr %5, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #3
  %15 = load float, ptr %4, align 4, !tbaa !9
  %16 = getelementptr inbounds %class.FeedbackCombFilter, ptr %7, i32 0, i32 1
  %17 = load float, ptr %16, align 8, !tbaa !16
  %18 = load float, ptr %5, align 4, !tbaa !9
  %19 = call float @llvm.fmuladd.f32(float %17, float %18, float %15)
  store float %19, ptr %6, align 4, !tbaa !9
  %20 = load float, ptr %6, align 4, !tbaa !9
  %21 = getelementptr inbounds %class.FeedbackCombFilter, ptr %7, i32 0, i32 2
  %22 = load ptr, ptr %21, align 8, !tbaa !11
  %23 = getelementptr inbounds %class.FeedbackCombFilter, ptr %7, i32 0, i32 3
  %24 = load i32, ptr %23, align 8, !tbaa !15
  %25 = sext i32 %24 to i64
  %26 = getelementptr inbounds float, ptr %22, i64 %25
  store float %20, ptr %26, align 4, !tbaa !9
  %27 = getelementptr inbounds %class.FeedbackCombFilter, ptr %7, i32 0, i32 3
  %28 = load i32, ptr %27, align 8, !tbaa !15
  %29 = add nsw i32 %28, 1
  %30 = getelementptr inbounds %class.FeedbackCombFilter, ptr %7, i32 0, i32 4
  %31 = load i32, ptr %30, align 4, !tbaa !17
  %32 = srem i32 %29, %31
  %33 = getelementptr inbounds %class.FeedbackCombFilter, ptr %7, i32 0, i32 3
  store i32 %32, ptr %33, align 8, !tbaa !15
  %34 = load float, ptr %6, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #3
  ret float %34
}

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

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

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

attributes #0 = { 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"float", !7, i64 0}
!11 = !{!12, !6, i64 16}
!12 = !{!"_ZTS18FeedbackCombFilter", !13, i64 0, !10, i64 8, !6, i64 16, !14, i64 24, !14, i64 28}
!13 = !{!"_ZTS6Filter"}
!14 = !{!"int", !7, i64 0}
!15 = !{!12, !14, i64 24}
!16 = !{!12, !10, i64 8}
!17 = !{!12, !14, i64 28}


; 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 nofree norecurse nosync nounwind willreturn memory(readwrite, inaccessiblemem: none) uwtable
define dso_local noundef float @_ZN18FeedbackCombFilter1fEf(ptr nocapture noundef nonnull align 8 dereferenceable(32) %0, float noundef %1) unnamed_addr #0 align 2 {
  %3 = getelementptr inbounds i8, ptr %0, i64 16
  %4 = load ptr, ptr %3, align 8, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %0, i64 24
  %6 = load i32, ptr %5, align 8, !tbaa !13
  %7 = sext i32 %6 to i64
  %8 = getelementptr inbounds float, ptr %4, i64 %7
  %9 = load float, ptr %8, align 4, !tbaa !14
  %10 = getelementptr inbounds i8, ptr %0, i64 8
  %11 = load float, ptr %10, align 8, !tbaa !15
  %12 = tail call float @llvm.fmuladd.f32(float %11, float %9, float %1)
  store float %12, ptr %8, align 4, !tbaa !14
  %13 = add nsw i32 %6, 1
  %14 = getelementptr inbounds i8, ptr %0, i64 28
  %15 = load i32, ptr %14, align 4, !tbaa !16
  %16 = srem i32 %13, %15
  store i32 %16, ptr %5, align 8, !tbaa !13
  ret float %12
}

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

attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, inaccessiblemem: none) 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 nocallback nofree nosync nounwind speculatable willreturn memory(none) }

!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, !11, i64 16}
!6 = !{!"_ZTS18FeedbackCombFilter", !7, i64 0, !8, i64 8, !11, i64 16, !12, i64 24, !12, i64 28}
!7 = !{!"_ZTS6Filter"}
!8 = !{!"float", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = !{!"any pointer", !9, i64 0}
!12 = !{!"int", !9, i64 0}
!13 = !{!6, !12, i64 24}
!14 = !{!8, !8, i64 0}
!15 = !{!6, !8, i64 8}
!16 = !{!6, !12, i64 28}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,TailCallElimPass