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

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

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

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

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: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

declare i32 @fskdem_destroy(ptr noundef) #1

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

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

21:                                               ; preds = %47, %0
  %22 = load i32, ptr %8, align 4, !tbaa !5
  %23 = load i32, ptr %5, align 4, !tbaa !5
  %24 = icmp ult i32 %22, %23
  br i1 %24, label %25, label %50

25:                                               ; preds = %21
  store i32 0, ptr %9, align 4, !tbaa !5
  br label %26

26:                                               ; preds = %41, %25
  %27 = load i32, ptr %9, align 4, !tbaa !5
  %28 = load i32, ptr %2, align 4, !tbaa !5
  %29 = icmp ult i32 %27, %28
  br i1 %29, label %30, label %44

30:                                               ; preds = %26
  %31 = call float (...) @randnf()
  %32 = call float (...) @randnf()
  %33 = fmul float 0.000000e+00, %32
  %34 = fmul float 1.000000e+00, %32
  %35 = fadd float %31, %33
  %36 = load i32, ptr %9, align 4, !tbaa !5
  %37 = zext i32 %36 to i64
  %38 = getelementptr inbounds { float, float }, ptr %20, i64 %37
  %39 = getelementptr inbounds { float, float }, ptr %38, i32 0, i32 0
  %40 = getelementptr inbounds { float, float }, ptr %38, i32 0, i32 1
  store float %35, ptr %39, align 8
  store float %34, ptr %40, align 4
  br label %41

41:                                               ; preds = %30
  %42 = load i32, ptr %9, align 4, !tbaa !5
  %43 = add i32 %42, 1
  store i32 %43, ptr %9, align 4, !tbaa !5
  br label %26, !llvm.loop !13

44:                                               ; preds = %26
  %45 = load ptr, ptr %4, align 8, !tbaa !11
  %46 = call i32 @fskdem_demodulate(ptr noundef %45, ptr noundef %20)
  br label %47

47:                                               ; preds = %44
  %48 = load i32, ptr %8, align 4, !tbaa !5
  %49 = add i32 %48, 1
  store i32 %49, ptr %8, align 4, !tbaa !5
  br label %21, !llvm.loop !15

50:                                               ; preds = %21
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #4
  %51 = load ptr, ptr %4, align 8, !tbaa !11
  %52 = call ptr @fskdem_copy(ptr noundef %51)
  store ptr %52, ptr %10, align 8, !tbaa !11
  store i32 0, ptr %8, align 4, !tbaa !5
  br label %53

53:                                               ; preds = %91, %50
  %54 = load i32, ptr %8, align 4, !tbaa !5
  %55 = load i32, ptr %5, align 4, !tbaa !5
  %56 = icmp ult i32 %54, %55
  br i1 %56, label %57, label %94

57:                                               ; preds = %53
  store i32 0, ptr %9, align 4, !tbaa !5
  br label %58

58:                                               ; preds = %73, %57
  %59 = load i32, ptr %9, align 4, !tbaa !5
  %60 = load i32, ptr %2, align 4, !tbaa !5
  %61 = icmp ult i32 %59, %60
  br i1 %61, label %62, label %76

62:                                               ; preds = %58
  %63 = call float (...) @randnf()
  %64 = call float (...) @randnf()
  %65 = fmul float 0.000000e+00, %64
  %66 = fmul float 1.000000e+00, %64
  %67 = fadd float %63, %65
  %68 = load i32, ptr %9, align 4, !tbaa !5
  %69 = zext i32 %68 to i64
  %70 = getelementptr inbounds { float, float }, ptr %20, 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 %66, ptr %72, align 4
  br label %73

73:                                               ; preds = %62
  %74 = load i32, ptr %9, align 4, !tbaa !5
  %75 = add i32 %74, 1
  store i32 %75, ptr %9, align 4, !tbaa !5
  br label %58, !llvm.loop !16

76:                                               ; preds = %58
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  %77 = load ptr, ptr %4, align 8, !tbaa !11
  %78 = call i32 @fskdem_demodulate(ptr noundef %77, ptr noundef %20)
  store i32 %78, ptr %11, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #4
  %79 = load ptr, ptr %10, align 8, !tbaa !11
  %80 = call i32 @fskdem_demodulate(ptr noundef %79, ptr noundef %20)
  store i32 %80, ptr %12, align 4, !tbaa !5
  %81 = load i32, ptr %11, align 4, !tbaa !5
  %82 = load i32, ptr %12, align 4, !tbaa !5
  %83 = icmp ne i32 %81, %82
  br i1 %83, label %84, label %89

84:                                               ; preds = %76
  %85 = load i32, ptr %11, align 4, !tbaa !5
  %86 = uitofp i32 %85 to double
  %87 = load i32, ptr %12, align 4, !tbaa !5
  %88 = uitofp i32 %87 to double
  call void @liquid_autotest_failed_expr(ptr noundef @.str.1, i32 noundef 163, ptr noundef @.str.6, double noundef %86, ptr noundef @.str.3, ptr noundef @.str.7, double noundef %88)
  br label %90

89:                                               ; preds = %76
  call void (...) @liquid_autotest_passed()
  br label %90

90:                                               ; preds = %89, %84
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  br label %91

91:                                               ; preds = %90
  %92 = load i32, ptr %8, align 4, !tbaa !5
  %93 = add i32 %92, 1
  store i32 %93, ptr %8, align 4, !tbaa !5
  br label %53, !llvm.loop !17

94:                                               ; preds = %53
  %95 = load ptr, ptr %4, align 8, !tbaa !11
  %96 = call i32 @fskdem_destroy(ptr noundef %95)
  %97 = load ptr, ptr %10, align 8, !tbaa !11
  %98 = call i32 @fskdem_destroy(ptr noundef %97)
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  %99 = load ptr, ptr %6, align 8
  call void @llvm.stackrestore.p0(ptr %99)
  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 4, ptr %3) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %1) #4
  ret void
}

declare float @randnf(...) #1

declare ptr @fskdem_copy(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 = { nocallback nofree nosync nounwind willreturn }
attributes #3 = { 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 #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 = !{!"float", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"any pointer", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = distinct !{!16, !14}
!17 = distinct !{!17, !14}


; 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.1 = external hidden unnamed_addr constant [90 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [9 x i8], align 1

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

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

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

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

declare i32 @fskdem_destroy(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local void @autotest_fskdem_copy() local_unnamed_addr #1 {
  %1 = tail call ptr @fskdem_create(i32 noundef 3, i32 noundef 200, float noundef 0x3FCE0418A0000000) #2
  %2 = alloca [200 x { float, float }], align 16
  br label %.preheader32

.preheader32:                                     ; preds = %0, %10
  %.034 = phi i32 [ 0, %0 ], [ %12, %10 ]
  br label %3

3:                                                ; preds = %.preheader32, %3
  %indvars.iv = phi i64 [ 0, %.preheader32 ], [ %indvars.iv.next, %3 ]
  %4 = call float (...) @randnf() #2
  %5 = call float (...) @randnf() #2
  %6 = fmul float %5, 0.000000e+00
  %7 = fadd float %4, %6
  %8 = getelementptr inbounds { float, float }, ptr %2, i64 %indvars.iv
  %9 = getelementptr inbounds i8, ptr %8, i64 4
  store float %7, ptr %8, align 8
  store float %5, ptr %9, align 4
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, 200
  br i1 %exitcond.not, label %10, label %3, !llvm.loop !5

10:                                               ; preds = %3
  %11 = call i32 @fskdem_demodulate(ptr noundef %1, ptr noundef nonnull %2) #2
  %12 = add nuw nsw i32 %.034, 1
  %exitcond38.not = icmp eq i32 %12, 96
  br i1 %exitcond38.not, label %13, label %.preheader32, !llvm.loop !7

13:                                               ; preds = %10
  %14 = call ptr @fskdem_copy(ptr noundef %1) #2
  br label %.preheader

.preheader:                                       ; preds = %13, %29
  %.136 = phi i32 [ 0, %13 ], [ %30, %29 ]
  br label %15

15:                                               ; preds = %.preheader, %15
  %indvars.iv39 = phi i64 [ 0, %.preheader ], [ %indvars.iv.next40, %15 ]
  %16 = call float (...) @randnf() #2
  %17 = call float (...) @randnf() #2
  %18 = fmul float %17, 0.000000e+00
  %19 = fadd float %16, %18
  %20 = getelementptr inbounds { float, float }, ptr %2, i64 %indvars.iv39
  %21 = getelementptr inbounds i8, ptr %20, i64 4
  store float %19, ptr %20, align 8
  store float %17, ptr %21, align 4
  %indvars.iv.next40 = add nuw nsw i64 %indvars.iv39, 1
  %exitcond42.not = icmp eq i64 %indvars.iv.next40, 200
  br i1 %exitcond42.not, label %22, label %15, !llvm.loop !8

22:                                               ; preds = %15
  %23 = call i32 @fskdem_demodulate(ptr noundef %1, ptr noundef nonnull %2) #2
  %24 = call i32 @fskdem_demodulate(ptr noundef %14, ptr noundef nonnull %2) #2
  %.not = icmp eq i32 %23, %24
  br i1 %.not, label %28, label %25

25:                                               ; preds = %22
  %26 = uitofp i32 %23 to double
  %27 = uitofp i32 %24 to double
  call void @liquid_autotest_failed_expr(ptr noundef nonnull @.str.1, i32 noundef 163, ptr noundef nonnull @.str.6, double noundef %26, ptr noundef nonnull @.str.3, ptr noundef nonnull @.str.7, double noundef %27) #2
  br label %29

28:                                               ; preds = %22
  call void (...) @liquid_autotest_passed() #2
  br label %29

29:                                               ; preds = %28, %25
  %30 = add nuw nsw i32 %.136, 1
  %exitcond43.not = icmp eq i32 %30, 96
  br i1 %exitcond43.not, label %31, label %.preheader, !llvm.loop !9

31:                                               ; preds = %29
  %32 = call i32 @fskdem_destroy(ptr noundef %1) #2
  %33 = call i32 @fskdem_destroy(ptr noundef %14) #2
  ret void
}

declare float @randnf(...) local_unnamed_addr #0

declare ptr @fskdem_copy(ptr noundef) local_unnamed_addr #0

attributes #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 = { 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 #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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = distinct !{!7, !6}
!8 = distinct !{!8, !6}
!9 = distinct !{!9, !6}


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