; LLVM IR from jgaeddert/liquid-dsp :: src/modem/tests (cpfskmodem_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"

@liquid_autotest_verbose = external global i32, align 4
@.str = external hidden unnamed_addr constant [38 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [1 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [92 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [11 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local void @cpfskmodem_test_mod_demod(ptr noundef %0, ptr noundef %1) #0 {
  %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 ptr, align 8
  %10 = alloca i64, align 8
  %11 = alloca i64, align 8
  %12 = alloca i64, align 8
  %13 = alloca ptr, align 8
  %14 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  %15 = load ptr, ptr %3, align 8, !tbaa !5
  %16 = call i32 @cpfskmod_get_delay(ptr noundef %15)
  %17 = load ptr, ptr %4, align 8, !tbaa !5
  %18 = call i32 @cpfskdem_get_delay(ptr noundef %17)
  %19 = add i32 %16, %18
  store i32 %19, ptr %5, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  %20 = load ptr, ptr %3, align 8, !tbaa !5
  %21 = call i32 @cpfskmod_get_samples_per_symbol(ptr noundef %20)
  store i32 %21, ptr %6, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  %22 = load ptr, ptr %3, align 8, !tbaa !5
  %23 = call i32 @cpfskmod_get_bits_per_symbol(ptr noundef %22)
  store i32 %23, ptr %7, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  %24 = load i32, ptr %5, align 4, !tbaa !9
  %25 = add i32 180, %24
  store i32 %25, ptr %8, align 4, !tbaa !9
  %26 = load i32, ptr %6, align 4, !tbaa !9
  %27 = zext i32 %26 to i64
  %28 = call ptr @llvm.stacksave.p0()
  store ptr %28, ptr %9, align 8
  %29 = alloca { float, float }, i64 %27, align 16
  store i64 %27, ptr %10, align 8
  %30 = load i32, ptr %8, align 4, !tbaa !9
  %31 = zext i32 %30 to i64
  %32 = alloca i32, i64 %31, align 16
  store i64 %31, ptr %11, align 8
  %33 = load i32, ptr %8, align 4, !tbaa !9
  %34 = zext i32 %33 to i64
  %35 = alloca i32, i64 %34, align 16
  store i64 %34, ptr %12, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #4
  %36 = call ptr @msequence_create_default(i32 noundef 7)
  store ptr %36, ptr %13, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #4
  store i32 0, ptr %14, align 4, !tbaa !9
  br label %37

37:                                               ; preds = %59, %2
  %38 = load i32, ptr %14, align 4, !tbaa !9
  %39 = load i32, ptr %8, align 4, !tbaa !9
  %40 = icmp ult i32 %38, %39
  br i1 %40, label %41, label %62

41:                                               ; preds = %37
  %42 = load ptr, ptr %13, align 8, !tbaa !5
  %43 = load i32, ptr %7, align 4, !tbaa !9
  %44 = call i32 @msequence_generate_symbol(ptr noundef %42, i32 noundef %43)
  %45 = load i32, ptr %14, align 4, !tbaa !9
  %46 = zext i32 %45 to i64
  %47 = getelementptr inbounds i32, ptr %32, i64 %46
  store i32 %44, ptr %47, align 4, !tbaa !9
  %48 = load ptr, ptr %3, align 8, !tbaa !5
  %49 = load i32, ptr %14, align 4, !tbaa !9
  %50 = zext i32 %49 to i64
  %51 = getelementptr inbounds i32, ptr %32, i64 %50
  %52 = load i32, ptr %51, align 4, !tbaa !9
  %53 = call i32 @cpfskmod_modulate(ptr noundef %48, i32 noundef %52, ptr noundef %29)
  %54 = load ptr, ptr %4, align 8, !tbaa !5
  %55 = call i32 @cpfskdem_demodulate(ptr noundef %54, ptr noundef %29)
  %56 = load i32, ptr %14, align 4, !tbaa !9
  %57 = zext i32 %56 to i64
  %58 = getelementptr inbounds i32, ptr %35, i64 %57
  store i32 %55, ptr %58, align 4, !tbaa !9
  br label %59

59:                                               ; preds = %41
  %60 = load i32, ptr %14, align 4, !tbaa !9
  %61 = add i32 %60, 1
  store i32 %61, ptr %14, align 4, !tbaa !9
  br label %37, !llvm.loop !11

62:                                               ; preds = %37
  %63 = load ptr, ptr %13, align 8, !tbaa !5
  %64 = call i32 @msequence_destroy(ptr noundef %63)
  store i32 0, ptr %14, align 4, !tbaa !9
  br label %65

65:                                               ; preds = %130, %62
  %66 = load i32, ptr %14, align 4, !tbaa !9
  %67 = load i32, ptr %8, align 4, !tbaa !9
  %68 = icmp ult i32 %66, %67
  br i1 %68, label %69, label %133

69:                                               ; preds = %65
  %70 = load i32, ptr %14, align 4, !tbaa !9
  %71 = load i32, ptr %5, align 4, !tbaa !9
  %72 = icmp uge i32 %70, %71
  br i1 %72, label %73, label %129

73:                                               ; preds = %69
  %74 = load i32, ptr @liquid_autotest_verbose, align 4, !tbaa !9
  %75 = icmp ne i32 %74, 0
  br i1 %75, label %76, label %102

76:                                               ; preds = %73
  %77 = load i32, ptr %14, align 4, !tbaa !9
  %78 = load i32, ptr %14, align 4, !tbaa !9
  %79 = load i32, ptr %5, align 4, !tbaa !9
  %80 = sub i32 %78, %79
  %81 = zext i32 %80 to i64
  %82 = getelementptr inbounds i32, ptr %32, i64 %81
  %83 = load i32, ptr %82, align 4, !tbaa !9
  %84 = load i32, ptr %14, align 4, !tbaa !9
  %85 = zext i32 %84 to i64
  %86 = getelementptr inbounds i32, ptr %35, i64 %85
  %87 = load i32, ptr %86, align 4, !tbaa !9
  %88 = load i32, ptr %14, align 4, !tbaa !9
  %89 = load i32, ptr %5, align 4, !tbaa !9
  %90 = sub i32 %88, %89
  %91 = zext i32 %90 to i64
  %92 = getelementptr inbounds i32, ptr %32, i64 %91
  %93 = load i32, ptr %92, align 4, !tbaa !9
  %94 = load i32, ptr %14, align 4, !tbaa !9
  %95 = zext i32 %94 to i64
  %96 = getelementptr inbounds i32, ptr %35, i64 %95
  %97 = load i32, ptr %96, align 4, !tbaa !9
  %98 = icmp eq i32 %93, %97
  %99 = zext i1 %98 to i64
  %100 = select i1 %98, ptr @.str.1, ptr @.str.2
  %101 = call i32 (ptr, ...) @printf(ptr noundef @.str, i32 noundef %77, i32 noundef %83, i32 noundef %87, ptr noundef %100)
  br label %102

102:                                              ; preds = %76, %73
  %103 = load i32, ptr %14, align 4, !tbaa !9
  %104 = load i32, ptr %5, align 4, !tbaa !9
  %105 = sub i32 %103, %104
  %106 = zext i32 %105 to i64
  %107 = getelementptr inbounds i32, ptr %32, i64 %106
  %108 = load i32, ptr %107, align 4, !tbaa !9
  %109 = load i32, ptr %14, align 4, !tbaa !9
  %110 = zext i32 %109 to i64
  %111 = getelementptr inbounds i32, ptr %35, i64 %110
  %112 = load i32, ptr %111, align 4, !tbaa !9
  %113 = icmp ne i32 %108, %112
  br i1 %113, label %114, label %127

114:                                              ; preds = %102
  %115 = load i32, ptr %14, align 4, !tbaa !9
  %116 = load i32, ptr %5, align 4, !tbaa !9
  %117 = sub i32 %115, %116
  %118 = zext i32 %117 to i64
  %119 = getelementptr inbounds i32, ptr %32, i64 %118
  %120 = load i32, ptr %119, align 4, !tbaa !9
  %121 = uitofp i32 %120 to double
  %122 = load i32, ptr %14, align 4, !tbaa !9
  %123 = zext i32 %122 to i64
  %124 = getelementptr inbounds i32, ptr %35, i64 %123
  %125 = load i32, ptr %124, align 4, !tbaa !9
  %126 = uitofp i32 %125 to double
  call void @liquid_autotest_failed_expr(ptr noundef @.str.3, i32 noundef 65, ptr noundef @.str.4, double noundef %121, ptr noundef @.str.5, ptr noundef @.str.6, double noundef %126)
  br label %128

127:                                              ; preds = %102
  call void (...) @liquid_autotest_passed()
  br label %128

128:                                              ; preds = %127, %114
  br label %129

129:                                              ; preds = %128, %69
  br label %130

130:                                              ; preds = %129
  %131 = load i32, ptr %14, align 4, !tbaa !9
  %132 = add i32 %131, 1
  store i32 %132, ptr %14, align 4, !tbaa !9
  br label %65, !llvm.loop !13

133:                                              ; preds = %65
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #4
  %134 = load ptr, ptr %9, align 8
  call void @llvm.stackrestore.p0(ptr %134)
  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
  ret void
}

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

declare i32 @cpfskmod_get_delay(ptr noundef) #2

declare i32 @cpfskdem_get_delay(ptr noundef) #2

declare i32 @cpfskmod_get_samples_per_symbol(ptr noundef) #2

declare i32 @cpfskmod_get_bits_per_symbol(ptr noundef) #2

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

declare ptr @msequence_create_default(i32 noundef) #2

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

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

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

declare i32 @msequence_destroy(ptr noundef) #2

declare i32 @printf(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

; 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"="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 = { 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 = !{!"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"}
!13 = distinct !{!13, !12}


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

@liquid_autotest_verbose = external local_unnamed_addr global i32, align 4
@.str = external hidden unnamed_addr constant [38 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [1 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [92 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [11 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local void @cpfskmodem_test_mod_demod(ptr noundef %0, ptr noundef %1) local_unnamed_addr #0 {
  %3 = tail call i32 @cpfskmod_get_delay(ptr noundef %0) #3
  %4 = tail call i32 @cpfskdem_get_delay(ptr noundef %1) #3
  %5 = add i32 %4, %3
  %6 = tail call i32 @cpfskmod_get_samples_per_symbol(ptr noundef %0) #3
  %7 = tail call i32 @cpfskmod_get_bits_per_symbol(ptr noundef %0) #3
  %8 = add i32 %5, 180
  %9 = zext i32 %6 to i64
  %10 = alloca { float, float }, i64 %9, align 16
  %11 = zext i32 %8 to i64
  %12 = alloca i32, i64 %11, align 16
  %13 = alloca i32, i64 %11, align 16
  %14 = tail call ptr @msequence_create_default(i32 noundef 7) #3
  %.not48 = icmp eq i32 %8, 0
  br i1 %.not48, label %._crit_edge.thread, label %.lr.ph

._crit_edge.thread:                               ; preds = %2
  %15 = tail call i32 @msequence_destroy(ptr noundef %14) #3
  br label %._crit_edge47

.lr.ph:                                           ; preds = %2, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %2 ]
  %16 = call i32 @msequence_generate_symbol(ptr noundef %14, i32 noundef %7) #3
  %17 = getelementptr inbounds i32, ptr %12, i64 %indvars.iv
  store i32 %16, ptr %17, align 4, !tbaa !5
  %18 = call i32 @cpfskmod_modulate(ptr noundef %0, i32 noundef %16, ptr noundef nonnull %10) #3
  %19 = call i32 @cpfskdem_demodulate(ptr noundef %1, ptr noundef nonnull %10) #3
  %20 = getelementptr inbounds i32, ptr %13, i64 %indvars.iv
  store i32 %19, ptr %20, align 4, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %11
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph, !llvm.loop !9

._crit_edge:                                      ; preds = %.lr.ph
  %21 = call i32 @msequence_destroy(ptr noundef %14) #3
  br i1 %.not48, label %._crit_edge47, label %.lr.ph46.preheader

.lr.ph46.preheader:                               ; preds = %._crit_edge
  %22 = zext i32 %5 to i64
  br label %.lr.ph46

.lr.ph46:                                         ; preds = %.lr.ph46.preheader, %44
  %indvars.iv51 = phi i64 [ 0, %.lr.ph46.preheader ], [ %indvars.iv.next52, %44 ]
  %.not = icmp ult i64 %indvars.iv51, %22
  br i1 %.not, label %44, label %23

23:                                               ; preds = %.lr.ph46
  %24 = load i32, ptr @liquid_autotest_verbose, align 4, !tbaa !5
  %.not41 = icmp eq i32 %24, 0
  br i1 %.not41, label %._crit_edge56, label %25

._crit_edge56:                                    ; preds = %23
  %.phi.trans.insert = getelementptr inbounds i32, ptr %13, i64 %indvars.iv51
  %.pre = load i32, ptr %.phi.trans.insert, align 4, !tbaa !5
  %.pre57 = trunc nuw i64 %indvars.iv51 to i32
  %.pre58 = sub i32 %.pre57, %5
  %.pre60 = zext i32 %.pre58 to i64
  br label %36

25:                                               ; preds = %23
  %26 = trunc nuw i64 %indvars.iv51 to i32
  %27 = sub i32 %26, %5
  %28 = zext i32 %27 to i64
  %29 = getelementptr inbounds i32, ptr %12, i64 %28
  %30 = load i32, ptr %29, align 4, !tbaa !5
  %31 = getelementptr inbounds i32, ptr %13, i64 %indvars.iv51
  %32 = load i32, ptr %31, align 4, !tbaa !5
  %33 = icmp eq i32 %30, %32
  %34 = select i1 %33, ptr @.str.1, ptr @.str.2
  %35 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %26, i32 noundef %30, i32 noundef %32, ptr noundef nonnull %34)
  br label %36

36:                                               ; preds = %._crit_edge56, %25
  %.pre-phi61 = phi i64 [ %.pre60, %._crit_edge56 ], [ %28, %25 ]
  %37 = phi i32 [ %.pre, %._crit_edge56 ], [ %32, %25 ]
  %38 = getelementptr inbounds i32, ptr %12, i64 %.pre-phi61
  %39 = load i32, ptr %38, align 4, !tbaa !5
  %.not42 = icmp eq i32 %39, %37
  br i1 %.not42, label %43, label %40

40:                                               ; preds = %36
  %41 = uitofp i32 %39 to double
  %42 = uitofp i32 %37 to double
  call void @liquid_autotest_failed_expr(ptr noundef nonnull @.str.3, i32 noundef 65, ptr noundef nonnull @.str.4, double noundef %41, ptr noundef nonnull @.str.5, ptr noundef nonnull @.str.6, double noundef %42) #3
  br label %44

43:                                               ; preds = %36
  call void (...) @liquid_autotest_passed() #3
  br label %44

44:                                               ; preds = %.lr.ph46, %43, %40
  %indvars.iv.next52 = add nuw nsw i64 %indvars.iv51, 1
  %exitcond55.not = icmp eq i64 %indvars.iv.next52, %11
  br i1 %exitcond55.not, label %._crit_edge47, label %.lr.ph46, !llvm.loop !11

._crit_edge47:                                    ; preds = %44, %._crit_edge.thread, %._crit_edge
  ret void
}

declare i32 @cpfskmod_get_delay(ptr noundef) local_unnamed_addr #1

declare i32 @cpfskdem_get_delay(ptr noundef) local_unnamed_addr #1

declare i32 @cpfskmod_get_samples_per_symbol(ptr noundef) local_unnamed_addr #1

declare i32 @cpfskmod_get_bits_per_symbol(ptr noundef) local_unnamed_addr #1

declare ptr @msequence_create_default(i32 noundef) local_unnamed_addr #1

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

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

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

declare i32 @msequence_destroy(ptr noundef) local_unnamed_addr #1

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 #1

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


; Effective O3 passes: BDCEPass,CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass