; LLVM IR from chriskiefer/libcccrt :: benchmarks/maximilian.ll (ZN13maxiDelayline2dlEdid)

; 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.maxiDelayline = type { double, i32, double, double, double, [705600 x double] }

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #0

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef double @_ZN13maxiDelayline2dlEdid(ptr noundef nonnull align 8 dereferenceable(5644840) %0, double noundef %1, i32 noundef %2, double noundef %3) #1 align 2 {
  %5 = alloca ptr, align 8
  %6 = alloca double, align 8
  %7 = alloca i32, align 4
  %8 = alloca double, align 8
  store ptr %0, ptr %5, align 8, !tbaa !5
  store double %1, ptr %6, align 8, !tbaa !9
  store i32 %2, ptr %7, align 4, !tbaa !11
  store double %3, ptr %8, align 8, !tbaa !9
  %9 = load ptr, ptr %5, align 8
  %10 = getelementptr inbounds %class.maxiDelayline, ptr %9, i32 0, i32 1
  %11 = load i32, ptr %10, align 8, !tbaa !13
  %12 = load i32, ptr %7, align 4, !tbaa !11
  %13 = icmp sge i32 %11, %12
  br i1 %13, label %14, label %16

14:                                               ; preds = %4
  %15 = getelementptr inbounds %class.maxiDelayline, ptr %9, i32 0, i32 1
  store i32 0, ptr %15, align 8, !tbaa !13
  br label %16

16:                                               ; preds = %14, %4
  %17 = getelementptr inbounds %class.maxiDelayline, ptr %9, i32 0, i32 5
  %18 = getelementptr inbounds %class.maxiDelayline, ptr %9, i32 0, i32 1
  %19 = load i32, ptr %18, align 8, !tbaa !13
  %20 = sext i32 %19 to i64
  %21 = getelementptr inbounds [705600 x double], ptr %17, i64 0, i64 %20
  %22 = load double, ptr %21, align 8, !tbaa !9
  %23 = getelementptr inbounds %class.maxiDelayline, ptr %9, i32 0, i32 4
  store double %22, ptr %23, align 8, !tbaa !15
  %24 = getelementptr inbounds %class.maxiDelayline, ptr %9, i32 0, i32 5
  %25 = getelementptr inbounds %class.maxiDelayline, ptr %9, i32 0, i32 1
  %26 = load i32, ptr %25, align 8, !tbaa !13
  %27 = sext i32 %26 to i64
  %28 = getelementptr inbounds [705600 x double], ptr %24, i64 0, i64 %27
  %29 = load double, ptr %28, align 8, !tbaa !9
  %30 = load double, ptr %8, align 8, !tbaa !9
  %31 = load double, ptr %6, align 8, !tbaa !9
  %32 = load double, ptr %8, align 8, !tbaa !9
  %33 = fmul double %31, %32
  %34 = fmul double %33, 5.000000e-01
  %35 = call double @llvm.fmuladd.f64(double %29, double %30, double %34)
  %36 = getelementptr inbounds %class.maxiDelayline, ptr %9, i32 0, i32 5
  %37 = getelementptr inbounds %class.maxiDelayline, ptr %9, i32 0, i32 1
  %38 = load i32, ptr %37, align 8, !tbaa !13
  %39 = sext i32 %38 to i64
  %40 = getelementptr inbounds [705600 x double], ptr %36, i64 0, i64 %39
  store double %35, ptr %40, align 8, !tbaa !9
  %41 = getelementptr inbounds %class.maxiDelayline, ptr %9, i32 0, i32 1
  %42 = load i32, ptr %41, align 8, !tbaa !13
  %43 = add nsw i32 %42, 1
  store i32 %43, ptr %41, align 8, !tbaa !13
  %44 = getelementptr inbounds %class.maxiDelayline, ptr %9, i32 0, i32 4
  %45 = load double, ptr %44, align 8, !tbaa !15
  ret double %45
}

attributes #0 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #1 = { 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" }

!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 = !{!14, !12, i64 8}
!14 = !{!"_ZTS13maxiDelayline", !10, i64 0, !12, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !7, i64 40}
!15 = !{!14, !10, i64 32}


; 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 nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #0

; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local noundef double @_ZN13maxiDelayline2dlEdid(ptr nocapture noundef nonnull align 8 dereferenceable(5644840) %0, double noundef %1, i32 noundef %2, double noundef %3) local_unnamed_addr #1 align 2 {
  %5 = getelementptr inbounds i8, ptr %0, i64 8
  %6 = load i32, ptr %5, align 8, !tbaa !5
  %.not = icmp slt i32 %6, %2
  %spec.select = select i1 %.not, i32 %6, i32 0
  %7 = getelementptr inbounds i8, ptr %0, i64 40
  %8 = sext i32 %spec.select to i64
  %9 = getelementptr inbounds [705600 x double], ptr %7, i64 0, i64 %8
  %10 = load double, ptr %9, align 8, !tbaa !11
  %11 = getelementptr inbounds i8, ptr %0, i64 32
  store double %10, ptr %11, align 8, !tbaa !12
  %12 = fmul double %1, %3
  %13 = fmul double %12, 5.000000e-01
  %14 = tail call double @llvm.fmuladd.f64(double %10, double %3, double %13)
  store double %14, ptr %9, align 8, !tbaa !11
  %15 = add nsw i32 %spec.select, 1
  store i32 %15, ptr %5, align 8, !tbaa !5
  %16 = load double, ptr %11, align 8, !tbaa !12
  ret double %16
}

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

!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, !10, i64 8}
!6 = !{!"_ZTS13maxiDelayline", !7, i64 0, !10, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !8, i64 40}
!7 = !{!"double", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!7, !7, i64 0}
!12 = !{!6, !7, i64 32}


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