; LLVM IR from jgaeddert/liquid-dsp :: src/framing/src (framingcf)

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

%struct.qpacketmodem_s = type { ptr, ptr, i32, i32, ptr, ptr, i32, i32, i32, i32, float }

@.str.16 = external hidden unnamed_addr constant [91 x i8], align 1
@.str.29 = external hidden unnamed_addr constant [47 x i8], align 1
@__PRETTY_FUNCTION__.qpacketmodem_decode_soft = external hidden unnamed_addr constant [78 x i8], align 1

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

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

declare i32 @packetizer_decode_soft(ptr noundef, ptr noundef, ptr noundef) #1

declare float @modemcf_get_demodulator_evm(ptr noundef) #1

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

; Function Attrs: nounwind
declare float @log10f(float noundef) #3

; Function Attrs: nounwind uwtable
define dso_local i32 @qpacketmodem_decode_soft(ptr noundef %0, ptr noundef %1, ptr noundef %2) #4 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca { float, float }, align 4
  %11 = alloca 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 4, ptr %7) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  store i32 0, ptr %9, align 4, !tbaa !9
  %12 = load ptr, ptr %4, align 8, !tbaa !5
  %13 = getelementptr inbounds %struct.qpacketmodem_s, ptr %12, i32 0, i32 10
  store float 0.000000e+00, ptr %13, align 8, !tbaa !11
  store i32 0, ptr %7, align 4, !tbaa !9
  br label %14

14:                                               ; preds = %57, %3
  %15 = load i32, ptr %7, align 4, !tbaa !9
  %16 = load ptr, ptr %4, align 8, !tbaa !5
  %17 = getelementptr inbounds %struct.qpacketmodem_s, ptr %16, i32 0, i32 8
  %18 = load i32, ptr %17, align 8, !tbaa !14
  %19 = icmp ult i32 %15, %18
  br i1 %19, label %20, label %60

20:                                               ; preds = %14
  %21 = load ptr, ptr %4, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct.qpacketmodem_s, ptr %21, i32 0, i32 0
  %23 = load ptr, ptr %22, align 8, !tbaa !15
  %24 = load ptr, ptr %5, align 8, !tbaa !5
  %25 = load i32, ptr %7, align 4, !tbaa !9
  %26 = zext i32 %25 to i64
  %27 = getelementptr inbounds { float, float }, ptr %24, i64 %26
  %28 = getelementptr inbounds { float, float }, ptr %27, i32 0, i32 0
  %29 = load float, ptr %28, align 4
  %30 = getelementptr inbounds { float, float }, ptr %27, i32 0, i32 1
  %31 = load float, ptr %30, align 4
  %32 = load ptr, ptr %4, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.qpacketmodem_s, ptr %32, i32 0, i32 4
  %34 = load ptr, ptr %33, align 8, !tbaa !16
  %35 = load i32, ptr %9, align 4, !tbaa !9
  %36 = zext i32 %35 to i64
  %37 = getelementptr inbounds i8, ptr %34, i64 %36
  %38 = getelementptr inbounds { float, float }, ptr %10, i32 0, i32 0
  %39 = getelementptr inbounds { float, float }, ptr %10, i32 0, i32 1
  store float %29, ptr %38, align 4
  store float %31, ptr %39, align 4
  %40 = load <2 x float>, ptr %10, align 4
  %41 = call i32 @modemcf_demodulate_soft(ptr noundef %23, <2 x float> noundef %40, ptr noundef %8, ptr noundef %37)
  %42 = load ptr, ptr %4, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.qpacketmodem_s, ptr %42, i32 0, i32 2
  %44 = load i32, ptr %43, align 8, !tbaa !17
  %45 = load i32, ptr %9, align 4, !tbaa !9
  %46 = add i32 %45, %44
  store i32 %46, ptr %9, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  %47 = load ptr, ptr %4, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.qpacketmodem_s, ptr %47, i32 0, i32 0
  %49 = load ptr, ptr %48, align 8, !tbaa !15
  %50 = call float @modemcf_get_demodulator_evm(ptr noundef %49)
  store float %50, ptr %11, align 4, !tbaa !18
  %51 = load float, ptr %11, align 4, !tbaa !18
  %52 = load float, ptr %11, align 4, !tbaa !18
  %53 = load ptr, ptr %4, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct.qpacketmodem_s, ptr %53, i32 0, i32 10
  %55 = load float, ptr %54, align 8, !tbaa !11
  %56 = call float @llvm.fmuladd.f32(float %51, float %52, float %55)
  store float %56, ptr %54, align 8, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  br label %57

57:                                               ; preds = %20
  %58 = load i32, ptr %7, align 4, !tbaa !9
  %59 = add i32 %58, 1
  store i32 %59, ptr %7, align 4, !tbaa !9
  br label %14, !llvm.loop !19

60:                                               ; preds = %14
  %61 = load i32, ptr %9, align 4, !tbaa !9
  %62 = load ptr, ptr %4, align 8, !tbaa !5
  %63 = getelementptr inbounds %struct.qpacketmodem_s, ptr %62, i32 0, i32 8
  %64 = load i32, ptr %63, align 8, !tbaa !14
  %65 = load ptr, ptr %4, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct.qpacketmodem_s, ptr %65, i32 0, i32 2
  %67 = load i32, ptr %66, align 8, !tbaa !17
  %68 = mul i32 %64, %67
  %69 = icmp eq i32 %61, %68
  br i1 %69, label %70, label %71

70:                                               ; preds = %60
  br label %72

71:                                               ; preds = %60
  call void @__assert_fail(ptr noundef @.str.29, ptr noundef @.str.16, i32 noundef 368, ptr noundef @__PRETTY_FUNCTION__.qpacketmodem_decode_soft) #7
  unreachable

72:                                               ; preds = %70
  %73 = load ptr, ptr %4, align 8, !tbaa !5
  %74 = getelementptr inbounds %struct.qpacketmodem_s, ptr %73, i32 0, i32 10
  %75 = load float, ptr %74, align 8, !tbaa !11
  %76 = load ptr, ptr %4, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.qpacketmodem_s, ptr %76, i32 0, i32 8
  %78 = load i32, ptr %77, align 8, !tbaa !14
  %79 = uitofp i32 %78 to float
  %80 = fdiv float %75, %79
  %81 = call float @log10f(float noundef %80) #6
  %82 = fmul float 1.000000e+01, %81
  %83 = load ptr, ptr %4, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct.qpacketmodem_s, ptr %83, i32 0, i32 10
  store float %82, ptr %84, align 8, !tbaa !11
  %85 = load ptr, ptr %4, align 8, !tbaa !5
  %86 = getelementptr inbounds %struct.qpacketmodem_s, ptr %85, i32 0, i32 1
  %87 = load ptr, ptr %86, align 8, !tbaa !21
  %88 = load ptr, ptr %4, align 8, !tbaa !5
  %89 = getelementptr inbounds %struct.qpacketmodem_s, ptr %88, i32 0, i32 4
  %90 = load ptr, ptr %89, align 8, !tbaa !16
  %91 = load ptr, ptr %6, align 8, !tbaa !5
  %92 = call i32 @packetizer_decode_soft(ptr noundef %87, ptr noundef %90, ptr noundef %91)
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  ret i32 %92
}

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

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #5

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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 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 #5 = { noreturn 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 #6 = { nounwind }
attributes #7 = { noreturn 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, !13, i64 56}
!12 = !{!"qpacketmodem_s", !6, i64 0, !6, i64 8, !10, i64 16, !10, i64 20, !6, i64 24, !6, i64 32, !10, i64 40, !10, i64 44, !10, i64 48, !10, i64 52, !13, i64 56}
!13 = !{!"float", !7, i64 0}
!14 = !{!12, !10, i64 48}
!15 = !{!12, !6, i64 0}
!16 = !{!12, !6, i64 24}
!17 = !{!12, !10, i64 16}
!18 = !{!13, !13, i64 0}
!19 = distinct !{!19, !20}
!20 = !{!"llvm.loop.mustprogress"}
!21 = !{!12, !6, i64 8}


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

@.str.16 = external hidden unnamed_addr constant [91 x i8], align 1
@.str.29 = external hidden unnamed_addr constant [47 x i8], align 1
@__PRETTY_FUNCTION__.qpacketmodem_decode_soft = external hidden unnamed_addr constant [78 x i8], align 1

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

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

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

declare float @modemcf_get_demodulator_evm(ptr noundef) local_unnamed_addr #1

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

; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare float @log10f(float noundef) local_unnamed_addr #3

; Function Attrs: nounwind uwtable
define dso_local i32 @qpacketmodem_decode_soft(ptr nocapture noundef %0, ptr nocapture noundef readonly %1, ptr noundef %2) local_unnamed_addr #4 {
  %4 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #6
  %5 = getelementptr inbounds i8, ptr %0, i64 56
  store float 0.000000e+00, ptr %5, align 8, !tbaa !5
  %6 = getelementptr inbounds i8, ptr %0, i64 48
  %7 = load i32, ptr %6, align 8, !tbaa !12
  %.not = icmp eq i32 %7, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %3
  %8 = getelementptr inbounds i8, ptr %0, i64 24
  %9 = getelementptr inbounds i8, ptr %0, i64 16
  br label %10

10:                                               ; preds = %.lr.ph, %10
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %10 ]
  %.02426 = phi i32 [ 0, %.lr.ph ], [ %19, %10 ]
  %11 = load ptr, ptr %0, align 8, !tbaa !13
  %12 = getelementptr inbounds { float, float }, ptr %1, i64 %indvars.iv
  %13 = load <2 x float>, ptr %12, align 4
  %14 = load ptr, ptr %8, align 8, !tbaa !14
  %15 = zext i32 %.02426 to i64
  %16 = getelementptr inbounds i8, ptr %14, i64 %15
  %17 = call i32 @modemcf_demodulate_soft(ptr noundef %11, <2 x float> noundef %13, ptr noundef nonnull %4, ptr noundef %16) #6
  %18 = load i32, ptr %9, align 8, !tbaa !15
  %19 = add i32 %18, %.02426
  %20 = load ptr, ptr %0, align 8, !tbaa !13
  %21 = call float @modemcf_get_demodulator_evm(ptr noundef %20) #6
  %22 = load float, ptr %5, align 8, !tbaa !5
  %23 = call float @llvm.fmuladd.f32(float %21, float %21, float %22)
  store float %23, ptr %5, align 8, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %24 = load i32, ptr %6, align 8, !tbaa !12
  %25 = zext i32 %24 to i64
  %26 = icmp ult i64 %indvars.iv.next, %25
  br i1 %26, label %10, label %._crit_edge, !llvm.loop !16

._crit_edge:                                      ; preds = %10, %3
  %27 = phi float [ 0.000000e+00, %3 ], [ %23, %10 ]
  %.024.lcssa = phi i32 [ 0, %3 ], [ %19, %10 ]
  %.lcssa = phi i32 [ 0, %3 ], [ %24, %10 ]
  %28 = getelementptr inbounds i8, ptr %0, i64 16
  %29 = load i32, ptr %28, align 8, !tbaa !15
  %30 = mul i32 %29, %.lcssa
  %31 = icmp eq i32 %.024.lcssa, %30
  br i1 %31, label %33, label %32

32:                                               ; preds = %._crit_edge
  call void @__assert_fail(ptr noundef nonnull @.str.29, ptr noundef nonnull @.str.16, i32 noundef 368, ptr noundef nonnull @__PRETTY_FUNCTION__.qpacketmodem_decode_soft) #7
  unreachable

33:                                               ; preds = %._crit_edge
  %34 = uitofp i32 %.lcssa to float
  %35 = fdiv float %27, %34
  %36 = call float @log10f(float noundef %35) #6
  %37 = fmul float %36, 1.000000e+01
  store float %37, ptr %5, align 8, !tbaa !5
  %38 = getelementptr inbounds i8, ptr %0, i64 8
  %39 = load ptr, ptr %38, align 8, !tbaa !18
  %40 = getelementptr inbounds i8, ptr %0, i64 24
  %41 = load ptr, ptr %40, align 8, !tbaa !14
  %42 = call i32 @packetizer_decode_soft(ptr noundef %39, ptr noundef %41, ptr noundef %2) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #6
  ret i32 %42
}

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

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #5

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 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #3 = { mustprogress nofree nounwind willreturn memory(write) "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 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 #5 = { noreturn 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 #6 = { nounwind }
attributes #7 = { noreturn 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, !11, i64 56}
!6 = !{!"qpacketmodem_s", !7, i64 0, !7, i64 8, !10, i64 16, !10, i64 20, !7, i64 24, !7, i64 32, !10, i64 40, !10, i64 44, !10, i64 48, !10, i64 52, !11, i64 56}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!"float", !8, i64 0}
!12 = !{!6, !10, i64 48}
!13 = !{!6, !7, i64 0}
!14 = !{!6, !7, i64 24}
!15 = !{!6, !10, i64 16}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}
!18 = !{!6, !7, i64 8}


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