; LLVM IR from jgaeddert/liquid-dsp :: src/modem/bench (fskdem_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 @fskdem_bench(ptr noundef %0, ptr noundef %1, ptr noundef %2, i32 noundef %3, i32 noundef %4, float noundef %5) #0 {
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca float, align 4
  %13 = alloca ptr, align 8
  %14 = alloca i64, align 8
  %15 = alloca ptr, align 8
  %16 = alloca i64, align 8
  %17 = alloca { float, float }, align 4
  %18 = alloca { float, 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 i32 %3, ptr %10, align 4, !tbaa !9
  store i32 %4, ptr %11, align 4, !tbaa !9
  store float %5, ptr %12, align 4, !tbaa !11
  %19 = load i32, ptr %11, align 4, !tbaa !9
  %20 = zext i32 %19 to i64
  %21 = load ptr, ptr %9, align 8, !tbaa !5
  %22 = load i64, ptr %21, align 8, !tbaa !13
  %23 = udiv i64 %22, %20
  store i64 %23, ptr %21, align 8, !tbaa !13
  %24 = load ptr, ptr %9, align 8, !tbaa !5
  %25 = load i64, ptr %24, align 8, !tbaa !13
  %26 = icmp ult i64 %25, 1
  br i1 %26, label %27, label %29

27:                                               ; preds = %6
  %28 = load ptr, ptr %9, align 8, !tbaa !5
  store i64 1, ptr %28, align 8, !tbaa !13
  br label %29

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

39:                                               ; preds = %73, %29
  %40 = load i64, ptr %14, align 8, !tbaa !13
  %41 = load i32, ptr %11, align 4, !tbaa !9
  %42 = add i32 %41, 10
  %43 = zext i32 %42 to i64
  %44 = icmp ult i64 %40, %43
  br i1 %44, label %45, label %76

45:                                               ; preds = %39
  %46 = load i64, ptr %14, align 8, !tbaa !13
  %47 = uitofp i64 %46 to double
  %48 = fmul double 7.000000e-02, %47
  %49 = load i64, ptr %14, align 8, !tbaa !13
  %50 = uitofp i64 %49 to double
  %51 = fmul double 0.000000e+00, %50
  %52 = fmul double 0x3FE41B2F769CF0E0, %50
  %53 = fptrunc double %51 to float
  %54 = fptrunc double %52 to float
  %55 = getelementptr inbounds { float, float }, ptr %17, i32 0, i32 0
  %56 = getelementptr inbounds { float, float }, ptr %17, i32 0, i32 1
  store float %53, ptr %55, align 4
  store float %54, ptr %56, align 4
  %57 = load <2 x float>, ptr %17, align 4
  %58 = call <2 x float> @cexpf(<2 x float> noundef %57) #5
  store <2 x float> %58, ptr %18, align 4
  %59 = getelementptr inbounds { float, float }, ptr %18, i32 0, i32 0
  %60 = load float, ptr %59, align 4
  %61 = getelementptr inbounds { float, float }, ptr %18, i32 0, i32 1
  %62 = load float, ptr %61, align 4
  %63 = fpext float %60 to double
  %64 = fpext float %62 to double
  %65 = fmul double %48, %63
  %66 = fmul double %48, %64
  %67 = fptrunc double %65 to float
  %68 = fptrunc double %66 to float
  %69 = load i64, ptr %14, align 8, !tbaa !13
  %70 = getelementptr inbounds { float, float }, ptr %38, i64 %69
  %71 = getelementptr inbounds { float, float }, ptr %70, i32 0, i32 0
  %72 = getelementptr inbounds { float, float }, ptr %70, i32 0, i32 1
  store float %67, ptr %71, align 8
  store float %68, ptr %72, align 4
  br label %73

73:                                               ; preds = %45
  %74 = load i64, ptr %14, align 8, !tbaa !13
  %75 = add i64 %74, 1
  store i64 %75, ptr %14, align 8, !tbaa !13
  br label %39, !llvm.loop !15

76:                                               ; preds = %39
  %77 = load ptr, ptr %7, align 8, !tbaa !5
  %78 = call i32 @getrusage(i32 noundef 0, ptr noundef %77) #5
  store i64 0, ptr %14, align 8, !tbaa !13
  br label %79

79:                                               ; preds = %115, %76
  %80 = load i64, ptr %14, align 8, !tbaa !13
  %81 = load ptr, ptr %9, align 8, !tbaa !5
  %82 = load i64, ptr %81, align 8, !tbaa !13
  %83 = icmp ult i64 %80, %82
  br i1 %83, label %84, label %118

84:                                               ; preds = %79
  %85 = load ptr, ptr %13, align 8, !tbaa !5
  %86 = getelementptr inbounds { float, float }, ptr %38, i64 0
  %87 = call i32 @fskdem_demodulate(ptr noundef %85, ptr noundef %86)
  %88 = load ptr, ptr %13, align 8, !tbaa !5
  %89 = getelementptr inbounds { float, float }, ptr %38, i64 1
  %90 = call i32 @fskdem_demodulate(ptr noundef %88, ptr noundef %89)
  %91 = load ptr, ptr %13, align 8, !tbaa !5
  %92 = getelementptr inbounds { float, float }, ptr %38, i64 2
  %93 = call i32 @fskdem_demodulate(ptr noundef %91, ptr noundef %92)
  %94 = load ptr, ptr %13, align 8, !tbaa !5
  %95 = getelementptr inbounds { float, float }, ptr %38, i64 3
  %96 = call i32 @fskdem_demodulate(ptr noundef %94, ptr noundef %95)
  %97 = load ptr, ptr %13, align 8, !tbaa !5
  %98 = getelementptr inbounds { float, float }, ptr %38, i64 4
  %99 = call i32 @fskdem_demodulate(ptr noundef %97, ptr noundef %98)
  %100 = load ptr, ptr %13, align 8, !tbaa !5
  %101 = getelementptr inbounds { float, float }, ptr %38, i64 5
  %102 = call i32 @fskdem_demodulate(ptr noundef %100, ptr noundef %101)
  %103 = load ptr, ptr %13, align 8, !tbaa !5
  %104 = getelementptr inbounds { float, float }, ptr %38, i64 6
  %105 = call i32 @fskdem_demodulate(ptr noundef %103, ptr noundef %104)
  %106 = load ptr, ptr %13, align 8, !tbaa !5
  %107 = getelementptr inbounds { float, float }, ptr %38, i64 7
  %108 = call i32 @fskdem_demodulate(ptr noundef %106, ptr noundef %107)
  %109 = load ptr, ptr %13, align 8, !tbaa !5
  %110 = getelementptr inbounds { float, float }, ptr %38, i64 8
  %111 = call i32 @fskdem_demodulate(ptr noundef %109, ptr noundef %110)
  %112 = load ptr, ptr %13, align 8, !tbaa !5
  %113 = getelementptr inbounds { float, float }, ptr %38, i64 9
  %114 = call i32 @fskdem_demodulate(ptr noundef %112, ptr noundef %113)
  br label %115

115:                                              ; preds = %84
  %116 = load i64, ptr %14, align 8, !tbaa !13
  %117 = add i64 %116, 1
  store i64 %117, ptr %14, align 8, !tbaa !13
  br label %79, !llvm.loop !17

118:                                              ; preds = %79
  %119 = load ptr, ptr %8, align 8, !tbaa !5
  %120 = call i32 @getrusage(i32 noundef 0, ptr noundef %119) #5
  %121 = load ptr, ptr %9, align 8, !tbaa !5
  %122 = load i64, ptr %121, align 8, !tbaa !13
  %123 = mul i64 %122, 10
  store i64 %123, ptr %121, align 8, !tbaa !13
  %124 = load ptr, ptr %13, align 8, !tbaa !5
  %125 = call i32 @fskdem_destroy(ptr noundef %124)
  %126 = load ptr, ptr %15, align 8
  call void @llvm.stackrestore.p0(ptr %126)
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  ret void
}

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

declare ptr @fskdem_create(i32 noundef, i32 noundef, float noundef) #2

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

; Function Attrs: nounwind
declare <2 x float> @cexpf(<2 x float> noundef) #4

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

declare i32 @fskdem_demodulate(ptr noundef, ptr noundef) #2

declare i32 @fskdem_destroy(ptr noundef) #2

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3

; 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"="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 #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 willreturn }
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 = !{!"float", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"long", !7, i64 0}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = distinct !{!17, !16}


; 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 @fskdem_bench(ptr noundef %0, ptr noundef %1, ptr nocapture noundef %2, i32 noundef %3, i32 noundef %4, float noundef %5) local_unnamed_addr #0 {
  %7 = zext i32 %4 to i64
  %8 = load i64, ptr %2, align 8, !tbaa !5
  %9 = udiv i64 %8, %7
  %10 = icmp ult i64 %8, %7
  %spec.select = select i1 %10, i64 1, i64 %9
  store i64 %spec.select, ptr %2, align 8, !tbaa !5
  %11 = tail call ptr @fskdem_create(i32 noundef %3, i32 noundef %4, float noundef %5) #3
  %12 = add i32 %4, 10
  %13 = zext i32 %12 to i64
  %14 = alloca { float, float }, i64 %13, align 16
  %.not = icmp eq i32 %12, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %6, %.lr.ph
  %.033 = phi i64 [ %26, %.lr.ph ], [ 0, %6 ]
  %15 = uitofp nneg i64 %.033 to double
  %16 = fmul double %15, 7.000000e-02
  %17 = fmul double %15, 0x3FE41B2F769CF0E0
  %18 = fptrunc double %17 to float
  %.sroa.01.4.vec.insert = insertelement <2 x float> <float 0.000000e+00, float poison>, float %18, i64 1
  %19 = tail call <2 x float> @cexpf(<2 x float> noundef %.sroa.01.4.vec.insert) #3
  %20 = getelementptr inbounds { float, float }, ptr %14, i64 %.033
  %21 = fpext <2 x float> %19 to <2 x double>
  %22 = insertelement <2 x double> poison, double %16, i64 0
  %23 = shufflevector <2 x double> %22, <2 x double> poison, <2 x i32> zeroinitializer
  %24 = fmul <2 x double> %23, %21
  %25 = fptrunc <2 x double> %24 to <2 x float>
  store <2 x float> %25, ptr %20, align 8
  %26 = add nuw nsw i64 %.033, 1
  %exitcond.not = icmp eq i64 %26, %13
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph, !llvm.loop !9

._crit_edge:                                      ; preds = %.lr.ph, %6
  %27 = tail call i32 @getrusage(i32 noundef 0, ptr noundef %0) #3
  %28 = load i64, ptr %2, align 8, !tbaa !5
  %.not38 = icmp eq i64 %28, 0
  br i1 %.not38, label %._crit_edge37, label %.lr.ph36

.lr.ph36:                                         ; preds = %._crit_edge
  %29 = getelementptr inbounds i8, ptr %14, i64 8
  %30 = getelementptr inbounds i8, ptr %14, i64 16
  %31 = getelementptr inbounds i8, ptr %14, i64 24
  %32 = getelementptr inbounds i8, ptr %14, i64 32
  %33 = getelementptr inbounds i8, ptr %14, i64 40
  %34 = getelementptr inbounds i8, ptr %14, i64 48
  %35 = getelementptr inbounds i8, ptr %14, i64 56
  %36 = getelementptr inbounds i8, ptr %14, i64 64
  %37 = getelementptr inbounds i8, ptr %14, i64 72
  br label %38

38:                                               ; preds = %.lr.ph36, %38
  %.134 = phi i64 [ 0, %.lr.ph36 ], [ %49, %38 ]
  %39 = call i32 @fskdem_demodulate(ptr noundef %11, ptr noundef nonnull %14) #3
  %40 = call i32 @fskdem_demodulate(ptr noundef %11, ptr noundef nonnull %29) #3
  %41 = call i32 @fskdem_demodulate(ptr noundef %11, ptr noundef nonnull %30) #3
  %42 = call i32 @fskdem_demodulate(ptr noundef %11, ptr noundef nonnull %31) #3
  %43 = call i32 @fskdem_demodulate(ptr noundef %11, ptr noundef nonnull %32) #3
  %44 = call i32 @fskdem_demodulate(ptr noundef %11, ptr noundef nonnull %33) #3
  %45 = call i32 @fskdem_demodulate(ptr noundef %11, ptr noundef nonnull %34) #3
  %46 = call i32 @fskdem_demodulate(ptr noundef %11, ptr noundef nonnull %35) #3
  %47 = call i32 @fskdem_demodulate(ptr noundef %11, ptr noundef nonnull %36) #3
  %48 = call i32 @fskdem_demodulate(ptr noundef %11, ptr noundef nonnull %37) #3
  %49 = add nuw i64 %.134, 1
  %50 = load i64, ptr %2, align 8, !tbaa !5
  %51 = icmp ult i64 %49, %50
  br i1 %51, label %38, label %._crit_edge37, !llvm.loop !11

._crit_edge37:                                    ; preds = %38, %._crit_edge
  %52 = call i32 @getrusage(i32 noundef 0, ptr noundef %1) #3
  %53 = load i64, ptr %2, align 8, !tbaa !5
  %54 = mul i64 %53, 10
  store i64 %54, ptr %2, align 8, !tbaa !5
  %55 = call i32 @fskdem_destroy(ptr noundef %11) #3
  ret void
}

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

; Function Attrs: nounwind
declare <2 x float> @cexpf(<2 x float> noundef) local_unnamed_addr #2

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

declare i32 @fskdem_demodulate(ptr noundef, ptr noundef) local_unnamed_addr #1

declare i32 @fskdem_destroy(ptr noundef) local_unnamed_addr #1

attributes #0 = { 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 #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 }

!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,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass