; LLVM IR from jgaeddert/liquid-dsp :: src/nco/bench (nco_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: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

declare ptr @nco_crcf_create(i32 noundef) #1

declare i32 @nco_crcf_set_phase(ptr noundef, float noundef) #1

declare i32 @nco_crcf_set_frequency(ptr noundef, float noundef) #1

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

declare i32 @nco_crcf_step(ptr noundef) #1

declare i32 @nco_crcf_destroy(ptr noundef) #1

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

; Function Attrs: nounwind uwtable
define dso_local void @benchmark_nco_mix_up(ptr noundef %0, ptr noundef %1, ptr noundef %2) #3 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca [16 x { float, float }], align 16
  %8 = alloca [16 x { float, float }], align 16
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca { float, float }, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store ptr %2, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 128, ptr %7) #5
  call void @llvm.lifetime.start.p0(i64 128, ptr %8) #5
  %13 = getelementptr inbounds [16 x { float, float }], ptr %7, i64 0, i64 0
  call void @llvm.memset.p0.i64(ptr align 16 %13, i8 0, i64 128, i1 false)
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  %14 = call ptr @nco_crcf_create(i32 noundef 0)
  store ptr %14, ptr %9, align 8, !tbaa !5
  %15 = load ptr, ptr %9, align 8, !tbaa !5
  %16 = call i32 @nco_crcf_set_phase(ptr noundef %15, float noundef 0.000000e+00)
  %17 = load ptr, ptr %9, align 8, !tbaa !5
  %18 = call i32 @nco_crcf_set_frequency(ptr noundef %17, float noundef 0x3FB99999A0000000)
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  %19 = load ptr, ptr %4, align 8, !tbaa !5
  %20 = call i32 @getrusage(i32 noundef 0, ptr noundef %19) #5
  store i32 0, ptr %10, align 4, !tbaa !9
  br label %21

21:                                               ; preds = %53, %3
  %22 = load i32, ptr %10, align 4, !tbaa !9
  %23 = zext i32 %22 to i64
  %24 = load ptr, ptr %6, align 8, !tbaa !5
  %25 = load i64, ptr %24, align 8, !tbaa !11
  %26 = icmp ult i64 %23, %25
  br i1 %26, label %27, label %56

27:                                               ; preds = %21
  store i32 0, ptr %11, align 4, !tbaa !9
  br label %28

28:                                               ; preds = %49, %27
  %29 = load i32, ptr %11, align 4, !tbaa !9
  %30 = icmp ult i32 %29, 16
  br i1 %30, label %31, label %52

31:                                               ; preds = %28
  %32 = load ptr, ptr %9, align 8, !tbaa !5
  %33 = load i32, ptr %11, align 4, !tbaa !9
  %34 = zext i32 %33 to i64
  %35 = getelementptr inbounds [16 x { float, float }], ptr %7, i64 0, i64 %34
  %36 = getelementptr inbounds { float, float }, ptr %35, i32 0, i32 0
  %37 = load float, ptr %36, align 8
  %38 = getelementptr inbounds { float, float }, ptr %35, i32 0, i32 1
  %39 = load float, ptr %38, align 4
  %40 = load i32, ptr %11, align 4, !tbaa !9
  %41 = zext i32 %40 to i64
  %42 = getelementptr inbounds [16 x { float, float }], ptr %8, i64 0, i64 %41
  %43 = getelementptr inbounds { float, float }, ptr %12, i32 0, i32 0
  %44 = getelementptr inbounds { float, float }, ptr %12, i32 0, i32 1
  store float %37, ptr %43, align 4
  store float %39, ptr %44, align 4
  %45 = load <2 x float>, ptr %12, align 4
  %46 = call i32 @nco_crcf_mix_up(ptr noundef %32, <2 x float> noundef %45, ptr noundef %42)
  %47 = load ptr, ptr %9, align 8, !tbaa !5
  %48 = call i32 @nco_crcf_step(ptr noundef %47)
  br label %49

49:                                               ; preds = %31
  %50 = load i32, ptr %11, align 4, !tbaa !9
  %51 = add i32 %50, 1
  store i32 %51, ptr %11, align 4, !tbaa !9
  br label %28, !llvm.loop !13

52:                                               ; preds = %28
  br label %53

53:                                               ; preds = %52
  %54 = load i32, ptr %10, align 4, !tbaa !9
  %55 = add i32 %54, 1
  store i32 %55, ptr %10, align 4, !tbaa !9
  br label %21, !llvm.loop !15

56:                                               ; preds = %21
  %57 = load ptr, ptr %5, align 8, !tbaa !5
  %58 = call i32 @getrusage(i32 noundef 0, ptr noundef %57) #5
  %59 = load ptr, ptr %6, align 8, !tbaa !5
  %60 = load i64, ptr %59, align 8, !tbaa !11
  %61 = mul i64 %60, 16
  store i64 %61, ptr %59, align 8, !tbaa !11
  %62 = load ptr, ptr %9, align 8, !tbaa !5
  %63 = call i32 @nco_crcf_destroy(ptr noundef %62)
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 128, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 128, ptr %7) #5
  ret void
}

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4

declare i32 @nco_crcf_mix_up(ptr noundef, <2 x float> noundef, ptr noundef) #1

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 = { nounwind uwtable "min-legal-vector-width"="64" "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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

declare ptr @nco_crcf_create(i32 noundef) local_unnamed_addr #1

declare i32 @nco_crcf_set_phase(ptr noundef, float noundef) local_unnamed_addr #1

declare i32 @nco_crcf_set_frequency(ptr noundef, float noundef) local_unnamed_addr #1

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

declare i32 @nco_crcf_step(ptr noundef) local_unnamed_addr #1

declare i32 @nco_crcf_destroy(ptr noundef) local_unnamed_addr #1

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

; Function Attrs: nounwind uwtable
define dso_local void @benchmark_nco_mix_up(ptr noundef %0, ptr noundef %1, ptr nocapture noundef %2) local_unnamed_addr #3 {
  %4 = alloca [16 x { float, float }], align 16
  call void @llvm.lifetime.start.p0(i64 128, ptr nonnull %4) #4
  %5 = tail call ptr @nco_crcf_create(i32 noundef 0) #4
  %6 = tail call i32 @nco_crcf_set_phase(ptr noundef %5, float noundef 0.000000e+00) #4
  %7 = tail call i32 @nco_crcf_set_frequency(ptr noundef %5, float noundef 0x3FB99999A0000000) #4
  %8 = tail call i32 @getrusage(i32 noundef 0, ptr noundef %0) #4
  %9 = load i64, ptr %2, align 8, !tbaa !5
  %.not = icmp eq i64 %9, 0
  br i1 %.not, label %._crit_edge, label %.preheader.preheader

.preheader.preheader:                             ; preds = %3
  %10 = getelementptr inbounds i8, ptr %4, i64 8
  %11 = getelementptr inbounds i8, ptr %4, i64 16
  %12 = getelementptr inbounds i8, ptr %4, i64 24
  %13 = getelementptr inbounds i8, ptr %4, i64 32
  %14 = getelementptr inbounds i8, ptr %4, i64 40
  %15 = getelementptr inbounds i8, ptr %4, i64 48
  %16 = getelementptr inbounds i8, ptr %4, i64 56
  %17 = getelementptr inbounds i8, ptr %4, i64 64
  %18 = getelementptr inbounds i8, ptr %4, i64 72
  %19 = getelementptr inbounds i8, ptr %4, i64 80
  %20 = getelementptr inbounds i8, ptr %4, i64 88
  %21 = getelementptr inbounds i8, ptr %4, i64 96
  %22 = getelementptr inbounds i8, ptr %4, i64 104
  %23 = getelementptr inbounds i8, ptr %4, i64 112
  %24 = getelementptr inbounds i8, ptr %4, i64 120
  br label %.preheader

.preheader:                                       ; preds = %.preheader.preheader, %.preheader
  %.01517 = phi i32 [ %57, %.preheader ], [ 0, %.preheader.preheader ]
  %25 = call i32 @nco_crcf_mix_up(ptr noundef %5, <2 x float> noundef zeroinitializer, ptr noundef nonnull %4) #4
  %26 = call i32 @nco_crcf_step(ptr noundef %5) #4
  %27 = call i32 @nco_crcf_mix_up(ptr noundef %5, <2 x float> noundef zeroinitializer, ptr noundef nonnull %10) #4
  %28 = call i32 @nco_crcf_step(ptr noundef %5) #4
  %29 = call i32 @nco_crcf_mix_up(ptr noundef %5, <2 x float> noundef zeroinitializer, ptr noundef nonnull %11) #4
  %30 = call i32 @nco_crcf_step(ptr noundef %5) #4
  %31 = call i32 @nco_crcf_mix_up(ptr noundef %5, <2 x float> noundef zeroinitializer, ptr noundef nonnull %12) #4
  %32 = call i32 @nco_crcf_step(ptr noundef %5) #4
  %33 = call i32 @nco_crcf_mix_up(ptr noundef %5, <2 x float> noundef zeroinitializer, ptr noundef nonnull %13) #4
  %34 = call i32 @nco_crcf_step(ptr noundef %5) #4
  %35 = call i32 @nco_crcf_mix_up(ptr noundef %5, <2 x float> noundef zeroinitializer, ptr noundef nonnull %14) #4
  %36 = call i32 @nco_crcf_step(ptr noundef %5) #4
  %37 = call i32 @nco_crcf_mix_up(ptr noundef %5, <2 x float> noundef zeroinitializer, ptr noundef nonnull %15) #4
  %38 = call i32 @nco_crcf_step(ptr noundef %5) #4
  %39 = call i32 @nco_crcf_mix_up(ptr noundef %5, <2 x float> noundef zeroinitializer, ptr noundef nonnull %16) #4
  %40 = call i32 @nco_crcf_step(ptr noundef %5) #4
  %41 = call i32 @nco_crcf_mix_up(ptr noundef %5, <2 x float> noundef zeroinitializer, ptr noundef nonnull %17) #4
  %42 = call i32 @nco_crcf_step(ptr noundef %5) #4
  %43 = call i32 @nco_crcf_mix_up(ptr noundef %5, <2 x float> noundef zeroinitializer, ptr noundef nonnull %18) #4
  %44 = call i32 @nco_crcf_step(ptr noundef %5) #4
  %45 = call i32 @nco_crcf_mix_up(ptr noundef %5, <2 x float> noundef zeroinitializer, ptr noundef nonnull %19) #4
  %46 = call i32 @nco_crcf_step(ptr noundef %5) #4
  %47 = call i32 @nco_crcf_mix_up(ptr noundef %5, <2 x float> noundef zeroinitializer, ptr noundef nonnull %20) #4
  %48 = call i32 @nco_crcf_step(ptr noundef %5) #4
  %49 = call i32 @nco_crcf_mix_up(ptr noundef %5, <2 x float> noundef zeroinitializer, ptr noundef nonnull %21) #4
  %50 = call i32 @nco_crcf_step(ptr noundef %5) #4
  %51 = call i32 @nco_crcf_mix_up(ptr noundef %5, <2 x float> noundef zeroinitializer, ptr noundef nonnull %22) #4
  %52 = call i32 @nco_crcf_step(ptr noundef %5) #4
  %53 = call i32 @nco_crcf_mix_up(ptr noundef %5, <2 x float> noundef zeroinitializer, ptr noundef nonnull %23) #4
  %54 = call i32 @nco_crcf_step(ptr noundef %5) #4
  %55 = call i32 @nco_crcf_mix_up(ptr noundef %5, <2 x float> noundef zeroinitializer, ptr noundef nonnull %24) #4
  %56 = call i32 @nco_crcf_step(ptr noundef %5) #4
  %57 = add i32 %.01517, 1
  %58 = zext i32 %57 to i64
  %59 = load i64, ptr %2, align 8, !tbaa !5
  %60 = icmp ugt i64 %59, %58
  br i1 %60, label %.preheader, label %._crit_edge, !llvm.loop !9

._crit_edge:                                      ; preds = %.preheader, %3
  %61 = call i32 @getrusage(i32 noundef 0, ptr noundef %1) #4
  %62 = load i64, ptr %2, align 8, !tbaa !5
  %63 = shl i64 %62, 4
  store i64 %63, ptr %2, align 8, !tbaa !5
  %64 = call i32 @nco_crcf_destroy(ptr noundef %5) #4
  call void @llvm.lifetime.end.p0(i64 128, ptr nonnull %4) #4
  ret void
}

declare i32 @nco_crcf_mix_up(ptr noundef, <2 x float> noundef, ptr noundef) local_unnamed_addr #1

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 = { nounwind uwtable "min-legal-vector-width"="64" "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"}


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