; LLVM IR from jgaeddert/liquid-dsp :: src/modem/tests (modem_demodsoft_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 [97 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [9 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local void @modemcf_test_demodsoft(i32 noundef %0) #0 {
  %2 = alloca i32, align 4
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca i64, align 8
  %12 = alloca { float, float }, align 4
  %13 = alloca { float, float }, align 4
  store i32 %0, ptr %2, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #4
  %14 = load i32, ptr %2, align 4, !tbaa !5
  %15 = call ptr @modemcf_create(i32 noundef %14)
  store ptr %15, ptr %3, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #4
  %16 = load i32, ptr %2, align 4, !tbaa !5
  %17 = call ptr @modemcf_create(i32 noundef %16)
  store ptr %17, ptr %4, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  %18 = load ptr, ptr %4, align 8, !tbaa !9
  %19 = call i32 @modemcf_get_bps(ptr noundef %18)
  store i32 %19, ptr %5, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  %20 = load i32, ptr %5, align 4, !tbaa !5
  %21 = shl i32 1, %20
  store i32 %21, ptr %8, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  %22 = load i32, ptr %5, align 4, !tbaa !5
  %23 = zext i32 %22 to i64
  %24 = call ptr @llvm.stacksave.p0()
  store ptr %24, ptr %10, align 8
  %25 = alloca i8, i64 %23, align 16
  store i64 %23, ptr %11, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #4
  store i32 0, ptr %6, align 4, !tbaa !5
  br label %26

26:                                               ; preds = %65, %1
  %27 = load i32, ptr %6, align 4, !tbaa !5
  %28 = load i32, ptr %8, align 4, !tbaa !5
  %29 = icmp ult i32 %27, %28
  br i1 %29, label %30, label %68

30:                                               ; preds = %26
  %31 = load ptr, ptr %3, align 8, !tbaa !9
  %32 = load i32, ptr %6, align 4, !tbaa !5
  %33 = call i32 @modemcf_modulate(ptr noundef %31, i32 noundef %32, ptr noundef %12)
  %34 = load ptr, ptr %4, align 8, !tbaa !9
  %35 = getelementptr inbounds { float, float }, ptr %12, i32 0, i32 0
  %36 = load float, ptr %35, align 4
  %37 = getelementptr inbounds { float, float }, ptr %12, i32 0, i32 1
  %38 = load float, ptr %37, align 4
  %39 = getelementptr inbounds { float, float }, ptr %13, i32 0, i32 0
  %40 = getelementptr inbounds { float, float }, ptr %13, i32 0, i32 1
  store float %36, ptr %39, align 4
  store float %38, ptr %40, align 4
  %41 = load <2 x float>, ptr %13, align 4
  %42 = call i32 @modemcf_demodulate_soft(ptr noundef %34, <2 x float> noundef %41, ptr noundef %7, ptr noundef %25)
  %43 = load i32, ptr %7, align 4, !tbaa !5
  %44 = load i32, ptr %6, align 4, !tbaa !5
  %45 = icmp ne i32 %43, %44
  br i1 %45, label %46, label %51

46:                                               ; preds = %30
  %47 = load i32, ptr %7, align 4, !tbaa !5
  %48 = uitofp i32 %47 to double
  %49 = load i32, ptr %6, align 4, !tbaa !5
  %50 = uitofp i32 %49 to double
  call void @liquid_autotest_failed_expr(ptr noundef @.str, i32 noundef 54, ptr noundef @.str.1, double noundef %48, ptr noundef @.str.2, ptr noundef @.str.3, double noundef %50)
  br label %52

51:                                               ; preds = %30
  call void (...) @liquid_autotest_passed()
  br label %52

52:                                               ; preds = %51, %46
  %53 = load i32, ptr %5, align 4, !tbaa !5
  %54 = call i32 @liquid_pack_soft_bits(ptr noundef %25, i32 noundef %53, ptr noundef %9)
  %55 = load i32, ptr %9, align 4, !tbaa !5
  %56 = load i32, ptr %6, align 4, !tbaa !5
  %57 = icmp ne i32 %55, %56
  br i1 %57, label %58, label %63

58:                                               ; preds = %52
  %59 = load i32, ptr %9, align 4, !tbaa !5
  %60 = uitofp i32 %59 to double
  %61 = load i32, ptr %6, align 4, !tbaa !5
  %62 = uitofp i32 %61 to double
  call void @liquid_autotest_failed_expr(ptr noundef @.str, i32 noundef 58, ptr noundef @.str.4, double noundef %60, ptr noundef @.str.2, ptr noundef @.str.3, double noundef %62)
  br label %64

63:                                               ; preds = %52
  call void (...) @liquid_autotest_passed()
  br label %64

64:                                               ; preds = %63, %58
  br label %65

65:                                               ; preds = %64
  %66 = load i32, ptr %6, align 4, !tbaa !5
  %67 = add i32 %66, 1
  store i32 %67, ptr %6, align 4, !tbaa !5
  br label %26, !llvm.loop !11

68:                                               ; preds = %26
  %69 = load ptr, ptr %3, align 8, !tbaa !9
  %70 = call i32 @modemcf_destroy(ptr noundef %69)
  %71 = load ptr, ptr %4, align 8, !tbaa !9
  %72 = call i32 @modemcf_destroy(ptr noundef %71)
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  %73 = load ptr, ptr %10, align 8
  call void @llvm.stackrestore.p0(ptr %73)
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #4
  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 @modemcf_create(i32 noundef) #2

declare i32 @modemcf_get_bps(ptr noundef) #2

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

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

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

declare void @liquid_autotest_failed_expr(ptr noundef, i32 noundef, ptr noundef, double noundef, ptr noundef, ptr noundef, double noundef) #2

declare void @liquid_autotest_passed(...) #2

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

declare i32 @modemcf_destroy(ptr noundef) #2

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

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

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 }

!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 = !{!"int", !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}
!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 [97 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [9 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local void @modemcf_test_demodsoft(i32 noundef %0) local_unnamed_addr #0 {
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca { float, float }, align 8
  %5 = tail call ptr @modemcf_create(i32 noundef %0) #4
  %6 = tail call ptr @modemcf_create(i32 noundef %0) #4
  %7 = tail call i32 @modemcf_get_bps(ptr noundef %6) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #4
  %8 = zext i32 %7 to i64
  %9 = tail call ptr @llvm.stacksave.p0()
  %10 = alloca i8, i64 %8, align 16
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #4
  br label %11

11:                                               ; preds = %1, %27
  %.022 = phi i32 [ 0, %1 ], [ %28, %27 ]
  %12 = call i32 @modemcf_modulate(ptr noundef %5, i32 noundef %.022, ptr noundef nonnull %4) #4
  %13 = load <2 x float>, ptr %4, align 8
  %14 = call i32 @modemcf_demodulate_soft(ptr noundef %6, <2 x float> noundef %13, ptr noundef nonnull %2, ptr noundef nonnull %10) #4
  %15 = load i32, ptr %2, align 4, !tbaa !5
  %.not = icmp eq i32 %15, %.022
  br i1 %.not, label %19, label %16

16:                                               ; preds = %11
  %17 = uitofp i32 %15 to double
  %18 = uitofp i32 %.022 to double
  call void @liquid_autotest_failed_expr(ptr noundef nonnull @.str, i32 noundef 54, ptr noundef nonnull @.str.1, double noundef %17, ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.3, double noundef %18) #4
  br label %20

19:                                               ; preds = %11
  call void (...) @liquid_autotest_passed() #4
  br label %20

20:                                               ; preds = %19, %16
  %21 = call i32 @liquid_pack_soft_bits(ptr noundef nonnull %10, i32 noundef %7, ptr noundef nonnull %3) #4
  %22 = load i32, ptr %3, align 4, !tbaa !5
  %.not21 = icmp eq i32 %22, %.022
  br i1 %.not21, label %26, label %23

23:                                               ; preds = %20
  %24 = uitofp i32 %22 to double
  %25 = uitofp i32 %.022 to double
  call void @liquid_autotest_failed_expr(ptr noundef nonnull @.str, i32 noundef 58, ptr noundef nonnull @.str.4, double noundef %24, ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.3, double noundef %25) #4
  br label %27

26:                                               ; preds = %20
  call void (...) @liquid_autotest_passed() #4
  br label %27

27:                                               ; preds = %23, %26
  %28 = add i32 %.022, 1
  %.0.highbits = lshr i32 %28, %7
  %29 = icmp eq i32 %.0.highbits, 0
  br i1 %29, label %11, label %30, !llvm.loop !9

30:                                               ; preds = %27
  %31 = call i32 @modemcf_destroy(ptr noundef %5) #4
  %32 = call i32 @modemcf_destroy(ptr noundef %6) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #4
  call void @llvm.stackrestore.p0(ptr %9)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #4
  ret void
}

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

declare ptr @modemcf_create(i32 noundef) local_unnamed_addr #2

declare i32 @modemcf_get_bps(ptr noundef) local_unnamed_addr #2

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

declare i32 @modemcf_modulate(ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #2

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

declare void @liquid_autotest_failed_expr(ptr noundef, i32 noundef, ptr noundef, double noundef, ptr noundef, ptr noundef, double noundef) local_unnamed_addr #2

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

declare i32 @liquid_pack_soft_bits(ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #2

declare i32 @modemcf_destroy(ptr noundef) local_unnamed_addr #2

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

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

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 = { mustprogress 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 = { mustprogress nocallback nofree nosync nounwind willreturn }
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 = !{!"int", !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,GlobalOptPass,IPSCCPPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,LICMPass,LoopRotatePass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass