; LLVM IR from jgaeddert/liquid-dsp :: src/dotprod/bench (dotprod_cccf_benchmark)

; 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 @dotprod_cccf_bench(ptr noundef %0, ptr noundef %1, ptr noundef %2, i32 noundef %3) #0 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca i64, align 8
  %11 = alloca i64, align 8
  %12 = alloca [8 x { float, float }], align 16
  %13 = alloca i32, align 4
  %14 = alloca ptr, align 8
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store ptr %2, ptr %7, align 8, !tbaa !5
  store i32 %3, ptr %8, align 4, !tbaa !9
  %15 = load ptr, ptr %7, align 8, !tbaa !5
  %16 = load i64, ptr %15, align 8, !tbaa !11
  %17 = mul i64 %16, 20
  %18 = load i32, ptr %8, align 4, !tbaa !9
  %19 = zext i32 %18 to i64
  %20 = udiv i64 %17, %19
  %21 = load ptr, ptr %7, align 8, !tbaa !5
  store i64 %20, ptr %21, align 8, !tbaa !11
  %22 = load ptr, ptr %7, align 8, !tbaa !5
  %23 = load i64, ptr %22, align 8, !tbaa !11
  %24 = icmp ult i64 %23, 1
  br i1 %24, label %25, label %27

25:                                               ; preds = %4
  %26 = load ptr, ptr %7, align 8, !tbaa !5
  store i64 1, ptr %26, align 8, !tbaa !11
  br label %27

27:                                               ; preds = %25, %4
  %28 = load i32, ptr %8, align 4, !tbaa !9
  %29 = zext i32 %28 to i64
  %30 = call ptr @llvm.stacksave.p0()
  store ptr %30, ptr %9, align 8
  %31 = alloca { float, float }, i64 %29, align 16
  store i64 %29, ptr %10, align 8
  %32 = load i32, ptr %8, align 4, !tbaa !9
  %33 = zext i32 %32 to i64
  %34 = alloca { float, float }, i64 %33, align 16
  store i64 %33, ptr %11, align 8
  call void @llvm.lifetime.start.p0(i64 64, ptr %12) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #5
  store i32 0, ptr %13, align 4, !tbaa !9
  br label %35

35:                                               ; preds = %60, %27
  %36 = load i32, ptr %13, align 4, !tbaa !9
  %37 = load i32, ptr %8, align 4, !tbaa !9
  %38 = icmp ult i32 %36, %37
  br i1 %38, label %39, label %63

39:                                               ; preds = %35
  %40 = call float (...) @randnf()
  %41 = call float (...) @randnf()
  %42 = fmul float 0.000000e+00, %41
  %43 = fmul float 1.000000e+00, %41
  %44 = fadd float %40, %42
  %45 = load i32, ptr %13, align 4, !tbaa !9
  %46 = zext i32 %45 to i64
  %47 = getelementptr inbounds { float, float }, ptr %31, i64 %46
  %48 = getelementptr inbounds { float, float }, ptr %47, i32 0, i32 0
  %49 = getelementptr inbounds { float, float }, ptr %47, i32 0, i32 1
  store float %44, ptr %48, align 8
  store float %43, ptr %49, align 4
  %50 = call float (...) @randnf()
  %51 = call float (...) @randnf()
  %52 = fmul float 0.000000e+00, %51
  %53 = fmul float 1.000000e+00, %51
  %54 = fadd float %50, %52
  %55 = load i32, ptr %13, align 4, !tbaa !9
  %56 = zext i32 %55 to i64
  %57 = getelementptr inbounds { float, float }, ptr %34, i64 %56
  %58 = getelementptr inbounds { float, float }, ptr %57, i32 0, i32 0
  %59 = getelementptr inbounds { float, float }, ptr %57, i32 0, i32 1
  store float %54, ptr %58, align 8
  store float %53, ptr %59, align 4
  br label %60

60:                                               ; preds = %39
  %61 = load i32, ptr %13, align 4, !tbaa !9
  %62 = add i32 %61, 1
  store i32 %62, ptr %13, align 4, !tbaa !9
  br label %35, !llvm.loop !13

63:                                               ; preds = %35
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #5
  %64 = load i32, ptr %8, align 4, !tbaa !9
  %65 = call ptr @dotprod_cccf_create(ptr noundef %34, i32 noundef %64)
  store ptr %65, ptr %14, align 8, !tbaa !5
  %66 = load ptr, ptr %5, align 8, !tbaa !5
  %67 = call i32 @getrusage(i32 noundef 0, ptr noundef %66) #5
  store i32 0, ptr %13, align 4, !tbaa !9
  br label %68

68:                                               ; preds = %99, %63
  %69 = load i32, ptr %13, align 4, !tbaa !9
  %70 = zext i32 %69 to i64
  %71 = load ptr, ptr %7, align 8, !tbaa !5
  %72 = load i64, ptr %71, align 8, !tbaa !11
  %73 = icmp ult i64 %70, %72
  br i1 %73, label %74, label %102

74:                                               ; preds = %68
  %75 = load ptr, ptr %14, align 8, !tbaa !5
  %76 = getelementptr inbounds [8 x { float, float }], ptr %12, i64 0, i64 0
  %77 = call i32 @dotprod_cccf_execute(ptr noundef %75, ptr noundef %31, ptr noundef %76)
  %78 = load ptr, ptr %14, align 8, !tbaa !5
  %79 = getelementptr inbounds [8 x { float, float }], ptr %12, i64 0, i64 1
  %80 = call i32 @dotprod_cccf_execute(ptr noundef %78, ptr noundef %31, ptr noundef %79)
  %81 = load ptr, ptr %14, align 8, !tbaa !5
  %82 = getelementptr inbounds [8 x { float, float }], ptr %12, i64 0, i64 2
  %83 = call i32 @dotprod_cccf_execute(ptr noundef %81, ptr noundef %31, ptr noundef %82)
  %84 = load ptr, ptr %14, align 8, !tbaa !5
  %85 = getelementptr inbounds [8 x { float, float }], ptr %12, i64 0, i64 3
  %86 = call i32 @dotprod_cccf_execute(ptr noundef %84, ptr noundef %31, ptr noundef %85)
  %87 = load ptr, ptr %14, align 8, !tbaa !5
  %88 = getelementptr inbounds [8 x { float, float }], ptr %12, i64 0, i64 4
  %89 = call i32 @dotprod_cccf_execute(ptr noundef %87, ptr noundef %31, ptr noundef %88)
  %90 = load ptr, ptr %14, align 8, !tbaa !5
  %91 = getelementptr inbounds [8 x { float, float }], ptr %12, i64 0, i64 5
  %92 = call i32 @dotprod_cccf_execute(ptr noundef %90, ptr noundef %31, ptr noundef %91)
  %93 = load ptr, ptr %14, align 8, !tbaa !5
  %94 = getelementptr inbounds [8 x { float, float }], ptr %12, i64 0, i64 6
  %95 = call i32 @dotprod_cccf_execute(ptr noundef %93, ptr noundef %31, ptr noundef %94)
  %96 = load ptr, ptr %14, align 8, !tbaa !5
  %97 = getelementptr inbounds [8 x { float, float }], ptr %12, i64 0, i64 7
  %98 = call i32 @dotprod_cccf_execute(ptr noundef %96, ptr noundef %31, ptr noundef %97)
  br label %99

99:                                               ; preds = %74
  %100 = load i32, ptr %13, align 4, !tbaa !9
  %101 = add i32 %100, 1
  store i32 %101, ptr %13, align 4, !tbaa !9
  br label %68, !llvm.loop !15

102:                                              ; preds = %68
  %103 = load ptr, ptr %6, align 8, !tbaa !5
  %104 = call i32 @getrusage(i32 noundef 0, ptr noundef %103) #5
  %105 = load ptr, ptr %7, align 8, !tbaa !5
  %106 = load i64, ptr %105, align 8, !tbaa !11
  %107 = mul i64 %106, 8
  store i64 %107, ptr %105, align 8, !tbaa !11
  %108 = load ptr, ptr %14, align 8, !tbaa !5
  %109 = call i32 @dotprod_cccf_destroy(ptr noundef %108)
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 64, ptr %12) #5
  %110 = load ptr, ptr %9, align 8
  call void @llvm.stackrestore.p0(ptr %110)
  ret void
}

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #1

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

declare float @randnf(...) #3

declare ptr @dotprod_cccf_create(ptr noundef, i32 noundef) #3

; Function Attrs: nounwind
declare i32 @getrusage(i32 noundef, ptr noundef) #4

declare i32 @dotprod_cccf_execute(ptr noundef, ptr noundef, ptr noundef) #3

declare i32 @dotprod_cccf_destroy(ptr noundef) #3

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

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #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 }
attributes #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 "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 #5 = { 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 = !{!"long", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}


; 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 @dotprod_cccf_bench(ptr noundef %0, ptr noundef %1, ptr nocapture noundef %2, i32 noundef %3) local_unnamed_addr #0 {
  %5 = alloca [8 x { float, float }], align 16
  %6 = load i64, ptr %2, align 8, !tbaa !5
  %7 = mul i64 %6, 20
  %8 = zext i32 %3 to i64
  %9 = udiv i64 %7, %8
  %10 = icmp ult i64 %7, %8
  %spec.select = select i1 %10, i64 1, i64 %9
  store i64 %spec.select, ptr %2, align 8, !tbaa !5
  %11 = alloca { float, float }, i64 %8, align 16
  %12 = alloca { float, float }, i64 %8, align 16
  call void @llvm.lifetime.start.p0(i64 64, ptr nonnull %5) #4
  %.not = icmp eq i32 %3, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %4, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %4 ]
  %13 = tail call float (...) @randnf() #4
  %14 = tail call float (...) @randnf() #4
  %15 = fmul float %14, 0.000000e+00
  %16 = fadd float %13, %15
  %17 = getelementptr inbounds { float, float }, ptr %11, i64 %indvars.iv
  %18 = getelementptr inbounds i8, ptr %17, i64 4
  store float %16, ptr %17, align 8
  store float %14, ptr %18, align 4
  %19 = tail call float (...) @randnf() #4
  %20 = tail call float (...) @randnf() #4
  %21 = fmul float %20, 0.000000e+00
  %22 = fadd float %19, %21
  %23 = getelementptr inbounds { float, float }, ptr %12, i64 %indvars.iv
  %24 = getelementptr inbounds i8, ptr %23, i64 4
  store float %22, ptr %23, align 8
  store float %20, ptr %24, align 4
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %8
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph, !llvm.loop !9

._crit_edge:                                      ; preds = %.lr.ph, %4
  %25 = call ptr @dotprod_cccf_create(ptr noundef nonnull %12, i32 noundef %3) #4
  %26 = call i32 @getrusage(i32 noundef 0, ptr noundef %0) #4
  %27 = load i64, ptr %2, align 8, !tbaa !5
  %.not34 = icmp eq i64 %27, 0
  br i1 %.not34, label %._crit_edge33, label %.lr.ph32

.lr.ph32:                                         ; preds = %._crit_edge
  %28 = getelementptr inbounds i8, ptr %5, i64 8
  %29 = getelementptr inbounds i8, ptr %5, i64 16
  %30 = getelementptr inbounds i8, ptr %5, i64 24
  %31 = getelementptr inbounds i8, ptr %5, i64 32
  %32 = getelementptr inbounds i8, ptr %5, i64 40
  %33 = getelementptr inbounds i8, ptr %5, i64 48
  %34 = getelementptr inbounds i8, ptr %5, i64 56
  br label %35

35:                                               ; preds = %.lr.ph32, %35
  %.130 = phi i32 [ 0, %.lr.ph32 ], [ %44, %35 ]
  %36 = call i32 @dotprod_cccf_execute(ptr noundef %25, ptr noundef nonnull %11, ptr noundef nonnull %5) #4
  %37 = call i32 @dotprod_cccf_execute(ptr noundef %25, ptr noundef nonnull %11, ptr noundef nonnull %28) #4
  %38 = call i32 @dotprod_cccf_execute(ptr noundef %25, ptr noundef nonnull %11, ptr noundef nonnull %29) #4
  %39 = call i32 @dotprod_cccf_execute(ptr noundef %25, ptr noundef nonnull %11, ptr noundef nonnull %30) #4
  %40 = call i32 @dotprod_cccf_execute(ptr noundef %25, ptr noundef nonnull %11, ptr noundef nonnull %31) #4
  %41 = call i32 @dotprod_cccf_execute(ptr noundef %25, ptr noundef nonnull %11, ptr noundef nonnull %32) #4
  %42 = call i32 @dotprod_cccf_execute(ptr noundef %25, ptr noundef nonnull %11, ptr noundef nonnull %33) #4
  %43 = call i32 @dotprod_cccf_execute(ptr noundef %25, ptr noundef nonnull %11, ptr noundef nonnull %34) #4
  %44 = add i32 %.130, 1
  %45 = zext i32 %44 to i64
  %46 = load i64, ptr %2, align 8, !tbaa !5
  %47 = icmp ugt i64 %46, %45
  br i1 %47, label %35, label %._crit_edge33, !llvm.loop !11

._crit_edge33:                                    ; preds = %35, %._crit_edge
  %48 = call i32 @getrusage(i32 noundef 0, ptr noundef %1) #4
  %49 = load i64, ptr %2, align 8, !tbaa !5
  %50 = shl i64 %49, 3
  store i64 %50, ptr %2, align 8, !tbaa !5
  %51 = call i32 @dotprod_cccf_destroy(ptr noundef %25) #4
  call void @llvm.lifetime.end.p0(i64 64, ptr nonnull %5) #4
  ret void
}

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

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

declare ptr @dotprod_cccf_create(ptr noundef, i32 noundef) local_unnamed_addr #2

; Function Attrs: nounwind
declare i32 @getrusage(i32 noundef, ptr noundef) local_unnamed_addr #3

declare i32 @dotprod_cccf_execute(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

declare i32 @dotprod_cccf_destroy(ptr noundef) local_unnamed_addr #2

; Function Attrs: mustprogress 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 = { mustprogress 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 = { 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 #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 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}


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