; LLVM IR from jgaeddert/liquid-dsp :: src/modem/tests (gmskmodem_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 [91 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.6 = 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 @gmskdem_create(i32 noundef, i32 noundef, float noundef) #1

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

declare i32 @gmskdem_demodulate(ptr noundef, 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

declare i32 @gmskdem_destroy(ptr noundef) #1

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

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

; Function Attrs: nounwind uwtable
define dso_local void @autotest_gmskdem_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 i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca ptr, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %1) #4
  store i32 5, ptr %1, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #4
  store i32 3, 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 @gmskdem_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 16, ptr %5, align 4, !tbaa !5
  %17 = load i32, ptr %1, 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
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  store i32 0, ptr %10, align 4, !tbaa !5
  br label %21

21:                                               ; preds = %47, %0
  %22 = load i32, ptr %10, 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 %11, align 4, !tbaa !5
  br label %26

26:                                               ; preds = %41, %25
  %27 = load i32, ptr %11, align 4, !tbaa !5
  %28 = load i32, ptr %1, 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 %11, 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 %11, align 4, !tbaa !5
  %43 = add i32 %42, 1
  store i32 %43, ptr %11, 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 @gmskdem_demodulate(ptr noundef %45, ptr noundef %20, ptr noundef %8)
  br label %47

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

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

53:                                               ; preds = %91, %50
  %54 = load i32, ptr %10, 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 %11, align 4, !tbaa !5
  br label %58

58:                                               ; preds = %73, %57
  %59 = load i32, ptr %11, align 4, !tbaa !5
  %60 = load i32, ptr %1, 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 %11, 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 %11, align 4, !tbaa !5
  %75 = add i32 %74, 1
  store i32 %75, ptr %11, align 4, !tbaa !5
  br label %58, !llvm.loop !16

76:                                               ; preds = %58
  %77 = load ptr, ptr %4, align 8, !tbaa !11
  %78 = call i32 @gmskdem_demodulate(ptr noundef %77, ptr noundef %20, ptr noundef %8)
  %79 = load ptr, ptr %12, align 8, !tbaa !11
  %80 = call i32 @gmskdem_demodulate(ptr noundef %79, ptr noundef %20, ptr noundef %9)
  %81 = load i32, ptr %8, align 4, !tbaa !5
  %82 = load i32, ptr %9, align 4, !tbaa !5
  %83 = icmp ne i32 %81, %82
  br i1 %83, label %84, label %89

84:                                               ; preds = %76
  %85 = load i32, ptr %8, align 4, !tbaa !5
  %86 = uitofp i32 %85 to double
  %87 = load i32, ptr %9, align 4, !tbaa !5
  %88 = uitofp i32 %87 to double
  call void @liquid_autotest_failed_expr(ptr noundef @.str, i32 noundef 180, ptr noundef @.str.5, double noundef %86, ptr noundef @.str.2, ptr noundef @.str.6, double noundef %88)
  br label %90

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

90:                                               ; preds = %89, %84
  br label %91

91:                                               ; preds = %90
  %92 = load i32, ptr %10, align 4, !tbaa !5
  %93 = add i32 %92, 1
  store i32 %93, ptr %10, 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 @gmskdem_destroy(ptr noundef %95)
  %97 = load ptr, ptr %12, align 8, !tbaa !11
  %98 = call i32 @gmskdem_destroy(ptr noundef %97)
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 4, 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 @gmskdem_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 = external hidden unnamed_addr constant [91 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [9 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

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

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

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

declare i32 @gmskdem_destroy(ptr noundef) local_unnamed_addr #1

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

; Function Attrs: nounwind uwtable
define dso_local void @autotest_gmskdem_copy() local_unnamed_addr #2 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = tail call ptr @gmskdem_create(i32 noundef 5, i32 noundef 3, float noundef 0x3FCE0418A0000000) #3
  %4 = alloca [5 x { float, float }], align 16
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #3
  %5 = getelementptr inbounds i8, ptr %4, i64 4
  %6 = getelementptr inbounds i8, ptr %4, i64 8
  %7 = getelementptr inbounds i8, ptr %4, i64 12
  %8 = getelementptr inbounds i8, ptr %4, i64 16
  %9 = getelementptr inbounds i8, ptr %4, i64 20
  %10 = getelementptr inbounds i8, ptr %4, i64 24
  %11 = getelementptr inbounds i8, ptr %4, i64 28
  %12 = getelementptr inbounds i8, ptr %4, i64 32
  %13 = getelementptr inbounds i8, ptr %4, i64 36
  br label %.preheader28

.preheader28:                                     ; preds = %0, %.preheader28
  %.030 = phi i32 [ 0, %0 ], [ %35, %.preheader28 ]
  %14 = call float (...) @randnf() #3
  %15 = call float (...) @randnf() #3
  %16 = fmul float %15, 0.000000e+00
  %17 = fadd float %14, %16
  store float %17, ptr %4, align 16
  store float %15, ptr %5, align 4
  %18 = call float (...) @randnf() #3
  %19 = call float (...) @randnf() #3
  %20 = fmul float %19, 0.000000e+00
  %21 = fadd float %18, %20
  store float %21, ptr %6, align 8
  store float %19, ptr %7, align 4
  %22 = call float (...) @randnf() #3
  %23 = call float (...) @randnf() #3
  %24 = fmul float %23, 0.000000e+00
  %25 = fadd float %22, %24
  store float %25, ptr %8, align 16
  store float %23, ptr %9, align 4
  %26 = call float (...) @randnf() #3
  %27 = call float (...) @randnf() #3
  %28 = fmul float %27, 0.000000e+00
  %29 = fadd float %26, %28
  store float %29, ptr %10, align 8
  store float %27, ptr %11, align 4
  %30 = call float (...) @randnf() #3
  %31 = call float (...) @randnf() #3
  %32 = fmul float %31, 0.000000e+00
  %33 = fadd float %30, %32
  store float %33, ptr %12, align 16
  store float %31, ptr %13, align 4
  %34 = call i32 @gmskdem_demodulate(ptr noundef %3, ptr noundef nonnull %4, ptr noundef nonnull %1) #3
  %35 = add nuw nsw i32 %.030, 1
  %exitcond.not = icmp eq i32 %35, 16
  br i1 %exitcond.not, label %36, label %.preheader28, !llvm.loop !5

36:                                               ; preds = %.preheader28
  %37 = getelementptr inbounds i8, ptr %4, i64 4
  %38 = getelementptr inbounds i8, ptr %4, i64 8
  %39 = getelementptr inbounds i8, ptr %4, i64 12
  %40 = getelementptr inbounds i8, ptr %4, i64 16
  %41 = getelementptr inbounds i8, ptr %4, i64 20
  %42 = getelementptr inbounds i8, ptr %4, i64 24
  %43 = getelementptr inbounds i8, ptr %4, i64 28
  %44 = getelementptr inbounds i8, ptr %4, i64 32
  %45 = getelementptr inbounds i8, ptr %4, i64 36
  %46 = call ptr @gmskdem_copy(ptr noundef %3) #3
  br label %.preheader

.preheader:                                       ; preds = %36, %75
  %.132 = phi i32 [ 0, %36 ], [ %76, %75 ]
  %47 = call float (...) @randnf() #3
  %48 = call float (...) @randnf() #3
  %49 = fmul float %48, 0.000000e+00
  %50 = fadd float %47, %49
  store float %50, ptr %4, align 16
  store float %48, ptr %37, align 4
  %51 = call float (...) @randnf() #3
  %52 = call float (...) @randnf() #3
  %53 = fmul float %52, 0.000000e+00
  %54 = fadd float %51, %53
  store float %54, ptr %38, align 8
  store float %52, ptr %39, align 4
  %55 = call float (...) @randnf() #3
  %56 = call float (...) @randnf() #3
  %57 = fmul float %56, 0.000000e+00
  %58 = fadd float %55, %57
  store float %58, ptr %40, align 16
  store float %56, ptr %41, align 4
  %59 = call float (...) @randnf() #3
  %60 = call float (...) @randnf() #3
  %61 = fmul float %60, 0.000000e+00
  %62 = fadd float %59, %61
  store float %62, ptr %42, align 8
  store float %60, ptr %43, align 4
  %63 = call float (...) @randnf() #3
  %64 = call float (...) @randnf() #3
  %65 = fmul float %64, 0.000000e+00
  %66 = fadd float %63, %65
  store float %66, ptr %44, align 16
  store float %64, ptr %45, align 4
  %67 = call i32 @gmskdem_demodulate(ptr noundef %3, ptr noundef nonnull %4, ptr noundef nonnull %1) #3
  %68 = call i32 @gmskdem_demodulate(ptr noundef %46, ptr noundef nonnull %4, ptr noundef nonnull %2) #3
  %69 = load i32, ptr %1, align 4, !tbaa !7
  %70 = load i32, ptr %2, align 4, !tbaa !7
  %.not = icmp eq i32 %69, %70
  br i1 %.not, label %74, label %71

71:                                               ; preds = %.preheader
  %72 = uitofp i32 %69 to double
  %73 = uitofp i32 %70 to double
  call void @liquid_autotest_failed_expr(ptr noundef nonnull @.str, i32 noundef 180, ptr noundef nonnull @.str.5, double noundef %72, ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.6, double noundef %73) #3
  br label %75

74:                                               ; preds = %.preheader
  call void (...) @liquid_autotest_passed() #3
  br label %75

75:                                               ; preds = %71, %74
  %76 = add nuw nsw i32 %.132, 1
  %exitcond36.not = icmp eq i32 %76, 16
  br i1 %exitcond36.not, label %77, label %.preheader, !llvm.loop !11

77:                                               ; preds = %75
  %78 = call i32 @gmskdem_destroy(ptr noundef %3) #3
  %79 = call i32 @gmskdem_destroy(ptr noundef %46) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #3
  ret void
}

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

declare ptr @gmskdem_copy(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"="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 #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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!8, !8, i64 0}
!8 = !{!"int", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
!11 = distinct !{!11, !6}


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