; LLVM IR from jgaeddert/liquid-dsp :: src/filter/src/iirdes.pll (iirdes_pll_active_lag)

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

@.str = external hidden unnamed_addr constant [82 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [58 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [63 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [53 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local void @iirdes_pll_active_lag(float noundef %0, float noundef %1, float noundef %2, ptr noundef %3, ptr noundef %4) #0 {
  %6 = alloca float, align 4
  %7 = alloca float, align 4
  %8 = alloca float, align 4
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca float, align 4
  %12 = alloca float, align 4
  %13 = alloca float, align 4
  store float %0, ptr %6, align 4, !tbaa !5
  store float %1, ptr %7, align 4, !tbaa !5
  store float %2, ptr %8, align 4, !tbaa !5
  store ptr %3, ptr %9, align 8, !tbaa !9
  store ptr %4, ptr %10, align 8, !tbaa !9
  %14 = load float, ptr %6, align 4, !tbaa !5
  %15 = fcmp ole float %14, 0.000000e+00
  br i1 %15, label %16, label %18

16:                                               ; preds = %5
  %17 = call i32 (i32, ptr, i32, ptr, ...) @liquid_error_fl(i32 noundef 3, ptr noundef @.str, i32 noundef 55, ptr noundef @.str.1)
  br label %87

18:                                               ; preds = %5
  %19 = load float, ptr %7, align 4, !tbaa !5
  %20 = fcmp ole float %19, 0.000000e+00
  br i1 %20, label %21, label %23

21:                                               ; preds = %18
  %22 = call i32 (i32, ptr, i32, ptr, ...) @liquid_error_fl(i32 noundef 3, ptr noundef @.str, i32 noundef 58, ptr noundef @.str.2)
  br label %87

23:                                               ; preds = %18
  %24 = load float, ptr %8, align 4, !tbaa !5
  %25 = fcmp ole float %24, 0.000000e+00
  br i1 %25, label %26, label %28

26:                                               ; preds = %23
  %27 = call i32 (i32, ptr, i32, ptr, ...) @liquid_error_fl(i32 noundef 3, ptr noundef @.str, i32 noundef 61, ptr noundef @.str.3)
  br label %87

28:                                               ; preds = %23
  br label %29

29:                                               ; preds = %28
  br label %30

30:                                               ; preds = %29
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #3
  %31 = load float, ptr %6, align 4, !tbaa !5
  store float %31, ptr %11, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #3
  %32 = load float, ptr %8, align 4, !tbaa !5
  %33 = load float, ptr %11, align 4, !tbaa !5
  %34 = load float, ptr %11, align 4, !tbaa !5
  %35 = fmul float %33, %34
  %36 = fdiv float %32, %35
  store float %36, ptr %12, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #3
  %37 = load float, ptr %7, align 4, !tbaa !5
  %38 = fmul float 2.000000e+00, %37
  %39 = load float, ptr %11, align 4, !tbaa !5
  %40 = fdiv float %38, %39
  %41 = load float, ptr %8, align 4, !tbaa !5
  %42 = fdiv float 1.000000e+00, %41
  %43 = fsub float %40, %42
  store float %43, ptr %13, align 4, !tbaa !5
  %44 = load float, ptr %8, align 4, !tbaa !5
  %45 = fmul float 2.000000e+00, %44
  %46 = fpext float %45 to double
  %47 = load float, ptr %13, align 4, !tbaa !5
  %48 = fdiv float %47, 2.000000e+00
  %49 = fpext float %48 to double
  %50 = fadd double 1.000000e+00, %49
  %51 = fmul double %46, %50
  %52 = fptrunc double %51 to float
  %53 = load ptr, ptr %9, align 8, !tbaa !9
  %54 = getelementptr inbounds float, ptr %53, i64 0
  store float %52, ptr %54, align 4, !tbaa !5
  %55 = load float, ptr %8, align 4, !tbaa !5
  %56 = fmul float 2.000000e+00, %55
  %57 = fpext float %56 to double
  %58 = fmul double %57, 2.000000e+00
  %59 = fptrunc double %58 to float
  %60 = load ptr, ptr %9, align 8, !tbaa !9
  %61 = getelementptr inbounds float, ptr %60, i64 1
  store float %59, ptr %61, align 4, !tbaa !5
  %62 = load float, ptr %8, align 4, !tbaa !5
  %63 = fmul float 2.000000e+00, %62
  %64 = fpext float %63 to double
  %65 = load float, ptr %13, align 4, !tbaa !5
  %66 = fdiv float %65, 2.000000e+00
  %67 = fpext float %66 to double
  %68 = fsub double 1.000000e+00, %67
  %69 = fmul double %64, %68
  %70 = fptrunc double %69 to float
  %71 = load ptr, ptr %9, align 8, !tbaa !9
  %72 = getelementptr inbounds float, ptr %71, i64 2
  store float %70, ptr %72, align 4, !tbaa !5
  %73 = load float, ptr %12, align 4, !tbaa !5
  %74 = fdiv float %73, 2.000000e+00
  %75 = fadd float 1.000000e+00, %74
  %76 = load ptr, ptr %10, align 8, !tbaa !9
  %77 = getelementptr inbounds float, ptr %76, i64 0
  store float %75, ptr %77, align 4, !tbaa !5
  %78 = load float, ptr %12, align 4, !tbaa !5
  %79 = fneg float %78
  %80 = load ptr, ptr %10, align 8, !tbaa !9
  %81 = getelementptr inbounds float, ptr %80, i64 1
  store float %79, ptr %81, align 4, !tbaa !5
  %82 = load float, ptr %12, align 4, !tbaa !5
  %83 = fdiv float %82, 2.000000e+00
  %84 = fadd float -1.000000e+00, %83
  %85 = load ptr, ptr %10, align 8, !tbaa !9
  %86 = getelementptr inbounds float, ptr %85, i64 2
  store float %84, ptr %86, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #3
  br label %87

87:                                               ; preds = %30, %26, %21, %16
  ret void
}

declare i32 @liquid_error_fl(i32 noundef, ptr noundef, i32 noundef, ptr noundef, ...) #1

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

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

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 = { "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 willreturn memory(argmem: readwrite) }
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 = !{!"float", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}


; 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 = external hidden unnamed_addr constant [82 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [58 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [63 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [53 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local void @iirdes_pll_active_lag(float noundef %0, float noundef %1, float noundef %2, ptr nocapture noundef writeonly %3, ptr nocapture noundef writeonly %4) local_unnamed_addr #0 {
  %6 = fcmp ugt float %0, 0.000000e+00
  br i1 %6, label %9, label %7

7:                                                ; preds = %5
  %8 = tail call i32 (i32, ptr, i32, ptr, ...) @liquid_error_fl(i32 noundef 3, ptr noundef nonnull @.str, i32 noundef 55, ptr noundef nonnull @.str.1) #2
  br label %43

9:                                                ; preds = %5
  %10 = fcmp ugt float %1, 0.000000e+00
  br i1 %10, label %13, label %11

11:                                               ; preds = %9
  %12 = tail call i32 (i32, ptr, i32, ptr, ...) @liquid_error_fl(i32 noundef 3, ptr noundef nonnull @.str, i32 noundef 58, ptr noundef nonnull @.str.2) #2
  br label %43

13:                                               ; preds = %9
  %14 = fcmp ugt float %2, 0.000000e+00
  br i1 %14, label %17, label %15

15:                                               ; preds = %13
  %16 = tail call i32 (i32, ptr, i32, ptr, ...) @liquid_error_fl(i32 noundef 3, ptr noundef nonnull @.str, i32 noundef 61, ptr noundef nonnull @.str.3) #2
  br label %43

17:                                               ; preds = %13
  %18 = fmul float %0, %0
  %19 = fdiv float %2, %18
  %20 = fmul float %1, 2.000000e+00
  %21 = fdiv float %20, %0
  %22 = fdiv float 1.000000e+00, %2
  %23 = fsub float %21, %22
  %24 = fmul float %2, 2.000000e+00
  %25 = fpext float %24 to double
  %26 = fmul float %23, 5.000000e-01
  %27 = fpext float %26 to double
  %28 = fadd double %27, 1.000000e+00
  %29 = fmul double %28, %25
  %30 = fptrunc double %29 to float
  store float %30, ptr %3, align 4, !tbaa !5
  %31 = fmul float %24, 2.000000e+00
  %32 = getelementptr inbounds i8, ptr %3, i64 4
  store float %31, ptr %32, align 4, !tbaa !5
  %33 = fsub double 1.000000e+00, %27
  %34 = fmul double %33, %25
  %35 = fptrunc double %34 to float
  %36 = getelementptr inbounds i8, ptr %3, i64 8
  store float %35, ptr %36, align 4, !tbaa !5
  %37 = fmul float %19, 5.000000e-01
  %38 = fadd float %37, 1.000000e+00
  store float %38, ptr %4, align 4, !tbaa !5
  %39 = fneg float %19
  %40 = getelementptr inbounds i8, ptr %4, i64 4
  store float %39, ptr %40, align 4, !tbaa !5
  %41 = fadd float %37, -1.000000e+00
  %42 = getelementptr inbounds i8, ptr %4, i64 8
  store float %41, ptr %42, align 4, !tbaa !5
  br label %43

43:                                               ; preds = %17, %15, %11, %7
  ret void
}

declare i32 @liquid_error_fl(i32 noundef, ptr noundef, i32 noundef, ptr noundef, ...) local_unnamed_addr #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 = { "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 }

!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 = !{!"float", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}


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