; LLVM IR from jgaeddert/liquid-dsp :: src/nco/tests (nco_crcf_autotest)

; 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 [88 x i8], align 1
@.str.32 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.33 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.34 = external hidden unnamed_addr constant [3 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 void @liquid_autotest_failed_expr(ptr noundef, i32 noundef, ptr noundef, double noundef, ptr noundef, ptr noundef, double noundef) #1

declare void @liquid_autotest_passed(...) #1

; Function Attrs: nounwind uwtable
define dso_local void @autotest_nco_crcf_copy() #2 {
  %1 = alloca ptr, align 8
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca { float, float }, align 4
  %6 = alloca { float, float }, align 4
  %7 = alloca { float, float }, align 4
  %8 = alloca { float, float }, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr %1) #4
  %9 = call ptr @nco_crcf_create(i32 noundef 1)
  store ptr %9, ptr %1, align 8, !tbaa !5
  %10 = load ptr, ptr %1, align 8, !tbaa !5
  %11 = call i32 @nco_crcf_set_phase(ptr noundef %10, float noundef 0x3FF3C0C200000000)
  %12 = load ptr, ptr %1, align 8, !tbaa !5
  %13 = call i32 @nco_crcf_set_frequency(ptr noundef %12, float noundef 0x4016B73180000000)
  %14 = load ptr, ptr %1, align 8, !tbaa !5
  %15 = call i32 @nco_crcf_pll_set_bandwidth(ptr noundef %14, float noundef 0x3F86872B00000000)
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #4
  %16 = load ptr, ptr %1, align 8, !tbaa !5
  %17 = call ptr @nco_crcf_copy(ptr noundef %16)
  store ptr %17, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #4
  store i32 240, ptr %4, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #4
  store i32 0, ptr %3, align 4, !tbaa !9
  br label %18

18:                                               ; preds = %71, %0
  %19 = load i32, ptr %3, align 4, !tbaa !9
  %20 = load i32, ptr %4, align 4, !tbaa !9
  %21 = icmp ult i32 %19, %20
  br i1 %21, label %22, label %74

22:                                               ; preds = %18
  %23 = load ptr, ptr %1, align 8, !tbaa !5
  %24 = call i32 @nco_crcf_cexpf(ptr noundef %23, ptr noundef %5)
  %25 = load ptr, ptr %2, align 8, !tbaa !5
  %26 = call i32 @nco_crcf_cexpf(ptr noundef %25, ptr noundef %6)
  %27 = load ptr, ptr %1, align 8, !tbaa !5
  %28 = getelementptr inbounds { float, float }, ptr %5, i32 0, i32 0
  %29 = load float, ptr %28, align 4
  %30 = getelementptr inbounds { float, float }, ptr %5, i32 0, i32 1
  %31 = load float, ptr %30, align 4
  %32 = getelementptr inbounds { float, float }, ptr %7, i32 0, i32 0
  %33 = getelementptr inbounds { float, float }, ptr %7, i32 0, i32 1
  store float %29, ptr %32, align 4
  store float %31, ptr %33, align 4
  %34 = load <2 x float>, ptr %7, align 4
  %35 = call float @cargf(<2 x float> noundef %34) #4
  %36 = call i32 @nco_crcf_pll_step(ptr noundef %27, float noundef %35)
  %37 = load ptr, ptr %2, align 8, !tbaa !5
  %38 = getelementptr inbounds { float, float }, ptr %6, i32 0, i32 0
  %39 = load float, ptr %38, align 4
  %40 = getelementptr inbounds { float, float }, ptr %6, i32 0, i32 1
  %41 = load float, ptr %40, align 4
  %42 = getelementptr inbounds { float, float }, ptr %8, i32 0, i32 0
  %43 = getelementptr inbounds { float, float }, ptr %8, i32 0, i32 1
  store float %39, ptr %42, align 4
  store float %41, ptr %43, align 4
  %44 = load <2 x float>, ptr %8, align 4
  %45 = call float @cargf(<2 x float> noundef %44) #4
  %46 = call i32 @nco_crcf_pll_step(ptr noundef %37, float noundef %45)
  %47 = load ptr, ptr %1, align 8, !tbaa !5
  %48 = call i32 @nco_crcf_step(ptr noundef %47)
  %49 = load ptr, ptr %2, align 8, !tbaa !5
  %50 = call i32 @nco_crcf_step(ptr noundef %49)
  %51 = getelementptr inbounds { float, float }, ptr %5, i32 0, i32 0
  %52 = load float, ptr %51, align 4
  %53 = getelementptr inbounds { float, float }, ptr %5, i32 0, i32 1
  %54 = load float, ptr %53, align 4
  %55 = getelementptr inbounds { float, float }, ptr %6, i32 0, i32 0
  %56 = load float, ptr %55, align 4
  %57 = getelementptr inbounds { float, float }, ptr %6, i32 0, i32 1
  %58 = load float, ptr %57, align 4
  %59 = fcmp une float %52, %56
  %60 = fcmp une float %54, %58
  %61 = or i1 %59, %60
  br i1 %61, label %62, label %69

62:                                               ; preds = %22
  %63 = getelementptr inbounds { float, float }, ptr %5, i32 0, i32 0
  %64 = load float, ptr %63, align 4
  %65 = fpext float %64 to double
  %66 = getelementptr inbounds { float, float }, ptr %6, i32 0, i32 0
  %67 = load float, ptr %66, align 4
  %68 = fpext float %67 to double
  call void @liquid_autotest_failed_expr(ptr noundef @.str, i32 noundef 114, ptr noundef @.str.32, double noundef %65, ptr noundef @.str.33, ptr noundef @.str.34, double noundef %68)
  br label %70

69:                                               ; preds = %22
  call void (...) @liquid_autotest_passed()
  br label %70

70:                                               ; preds = %69, %62
  br label %71

71:                                               ; preds = %70
  %72 = load i32, ptr %3, align 4, !tbaa !9
  %73 = add i32 %72, 1
  store i32 %73, ptr %3, align 4, !tbaa !9
  br label %18, !llvm.loop !11

74:                                               ; preds = %18
  %75 = load ptr, ptr %1, align 8, !tbaa !5
  %76 = call i32 @nco_crcf_destroy(ptr noundef %75)
  %77 = load ptr, ptr %2, align 8, !tbaa !5
  %78 = call i32 @nco_crcf_destroy(ptr noundef %77)
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %1) #4
  ret void
}

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

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

declare ptr @nco_crcf_copy(ptr noundef) #1

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

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

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

declare i32 @nco_crcf_step(ptr noundef) #1

declare i32 @nco_crcf_destroy(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 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 #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 = !{!"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 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}


; 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 [88 x i8], align 1
@.str.32 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.33 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.34 = external hidden unnamed_addr constant [3 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 void @liquid_autotest_failed_expr(ptr noundef, i32 noundef, ptr noundef, double noundef, ptr noundef, ptr noundef, double noundef) local_unnamed_addr #1

declare void @liquid_autotest_passed(...) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local void @autotest_nco_crcf_copy() local_unnamed_addr #2 {
  %1 = alloca { float, float }, align 8
  %2 = alloca { float, float }, align 8
  %3 = tail call ptr @nco_crcf_create(i32 noundef 1) #4
  %4 = tail call i32 @nco_crcf_set_phase(ptr noundef %3, float noundef 0x3FF3C0C200000000) #4
  %5 = tail call i32 @nco_crcf_set_frequency(ptr noundef %3, float noundef 0x4016B73180000000) #4
  %6 = tail call i32 @nco_crcf_pll_set_bandwidth(ptr noundef %3, float noundef 0x3F86872B00000000) #4
  %7 = tail call ptr @nco_crcf_copy(ptr noundef %3) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #4
  %8 = getelementptr inbounds i8, ptr %1, i64 4
  %9 = getelementptr inbounds i8, ptr %2, i64 4
  br label %10

10:                                               ; preds = %0, %32
  %.017 = phi i32 [ 0, %0 ], [ %33, %32 ]
  %11 = call i32 @nco_crcf_cexpf(ptr noundef %3, ptr noundef nonnull %1) #4
  %12 = call i32 @nco_crcf_cexpf(ptr noundef %7, ptr noundef nonnull %2) #4
  %13 = load <2 x float>, ptr %1, align 8
  %14 = call float @cargf(<2 x float> noundef %13) #4
  %15 = call i32 @nco_crcf_pll_step(ptr noundef %3, float noundef %14) #4
  %16 = load <2 x float>, ptr %2, align 8
  %17 = call float @cargf(<2 x float> noundef %16) #4
  %18 = call i32 @nco_crcf_pll_step(ptr noundef %7, float noundef %17) #4
  %19 = call i32 @nco_crcf_step(ptr noundef %3) #4
  %20 = call i32 @nco_crcf_step(ptr noundef %7) #4
  %21 = load float, ptr %1, align 8
  %22 = load float, ptr %8, align 4
  %23 = load float, ptr %2, align 8
  %24 = load float, ptr %9, align 4
  %25 = fcmp une float %21, %23
  %26 = fcmp une float %22, %24
  %27 = or i1 %25, %26
  br i1 %27, label %28, label %31

28:                                               ; preds = %10
  %29 = fpext float %21 to double
  %30 = fpext float %23 to double
  call void @liquid_autotest_failed_expr(ptr noundef nonnull @.str, i32 noundef 114, ptr noundef nonnull @.str.32, double noundef %29, ptr noundef nonnull @.str.33, ptr noundef nonnull @.str.34, double noundef %30) #4
  br label %32

31:                                               ; preds = %10
  call void (...) @liquid_autotest_passed() #4
  br label %32

32:                                               ; preds = %28, %31
  %33 = add nuw nsw i32 %.017, 1
  %exitcond.not = icmp eq i32 %33, 240
  br i1 %exitcond.not, label %34, label %10, !llvm.loop !5

34:                                               ; preds = %32
  %35 = call i32 @nco_crcf_destroy(ptr noundef %3) #4
  %36 = call i32 @nco_crcf_destroy(ptr noundef %7) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #4
  ret void
}

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

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

declare ptr @nco_crcf_copy(ptr noundef) local_unnamed_addr #1

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

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

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

declare i32 @nco_crcf_step(ptr noundef) local_unnamed_addr #1

declare i32 @nco_crcf_destroy(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 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 #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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,LICMPass,LoopRotatePass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass