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

@liquid_autotest_verbose = external global i32, align 4
@.str.1 = external hidden unnamed_addr constant [90 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [60 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 @fskmod_create(i32 noundef, i32 noundef, float noundef) #1

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

declare i32 @fskmod_modulate(ptr noundef, i32 noundef, ptr 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 @fskmod_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_fskmod_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 i64, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca i8, align 1
  %12 = alloca ptr, align 8
  %13 = alloca i8, align 1
  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
  %14 = load i32, ptr %1, align 4, !tbaa !5
  %15 = load i32, ptr %2, align 4, !tbaa !5
  %16 = load float, ptr %3, align 4, !tbaa !9
  %17 = call ptr @fskmod_create(i32 noundef %14, i32 noundef %15, float noundef %16)
  store ptr %17, 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
  %18 = load i32, ptr %2, align 4, !tbaa !5
  %19 = zext i32 %18 to i64
  %20 = call ptr @llvm.stacksave.p0()
  store ptr %20, ptr %6, align 8
  %21 = alloca { float, float }, i64 %19, align 16
  store i64 %19, ptr %7, align 8
  %22 = load i32, ptr %2, align 4, !tbaa !5
  %23 = zext i32 %22 to i64
  %24 = alloca { float, float }, i64 %23, align 16
  store i64 %23, ptr %8, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  %25 = call ptr @msequence_create_default(i32 noundef 7)
  store ptr %25, ptr %9, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  store i32 0, ptr %10, align 4, !tbaa !5
  br label %26

26:                                               ; preds = %39, %0
  %27 = load i32, ptr %10, align 4, !tbaa !5
  %28 = load i32, ptr %5, align 4, !tbaa !5
  %29 = icmp ult i32 %27, %28
  br i1 %29, label %30, label %42

30:                                               ; preds = %26
  call void @llvm.lifetime.start.p0(i64 1, ptr %11) #4
  %31 = load ptr, ptr %9, align 8, !tbaa !11
  %32 = load i32, ptr %1, align 4, !tbaa !5
  %33 = call i32 @msequence_generate_symbol(ptr noundef %31, i32 noundef %32)
  %34 = trunc i32 %33 to i8
  store i8 %34, ptr %11, align 1, !tbaa !13
  %35 = load ptr, ptr %4, align 8, !tbaa !11
  %36 = load i8, ptr %11, align 1, !tbaa !13
  %37 = zext i8 %36 to i32
  %38 = call i32 @fskmod_modulate(ptr noundef %35, i32 noundef %37, ptr noundef %21)
  call void @llvm.lifetime.end.p0(i64 1, ptr %11) #4
  br label %39

39:                                               ; preds = %30
  %40 = load i32, ptr %10, align 4, !tbaa !5
  %41 = add i32 %40, 1
  store i32 %41, ptr %10, align 4, !tbaa !5
  br label %26, !llvm.loop !14

42:                                               ; preds = %26
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #4
  %43 = load ptr, ptr %4, align 8, !tbaa !11
  %44 = call ptr @fskmod_copy(ptr noundef %43)
  store ptr %44, ptr %12, align 8, !tbaa !11
  store i32 0, ptr %10, align 4, !tbaa !5
  br label %45

45:                                               ; preds = %83, %42
  %46 = load i32, ptr %10, align 4, !tbaa !5
  %47 = load i32, ptr %5, align 4, !tbaa !5
  %48 = icmp ult i32 %46, %47
  br i1 %48, label %49, label %86

49:                                               ; preds = %45
  call void @llvm.lifetime.start.p0(i64 1, ptr %13) #4
  %50 = load ptr, ptr %9, align 8, !tbaa !11
  %51 = load i32, ptr %1, align 4, !tbaa !5
  %52 = call i32 @msequence_generate_symbol(ptr noundef %50, i32 noundef %51)
  %53 = trunc i32 %52 to i8
  store i8 %53, ptr %13, align 1, !tbaa !13
  %54 = load ptr, ptr %4, align 8, !tbaa !11
  %55 = load i8, ptr %13, align 1, !tbaa !13
  %56 = zext i8 %55 to i32
  %57 = call i32 @fskmod_modulate(ptr noundef %54, i32 noundef %56, ptr noundef %21)
  %58 = load ptr, ptr %12, align 8, !tbaa !11
  %59 = load i8, ptr %13, align 1, !tbaa !13
  %60 = zext i8 %59 to i32
  %61 = call i32 @fskmod_modulate(ptr noundef %58, i32 noundef %60, ptr noundef %24)
  %62 = load i32, ptr %2, align 4, !tbaa !5
  %63 = zext i32 %62 to i64
  %64 = mul i64 %63, 8
  %65 = trunc i64 %64 to i32
  %66 = call i32 @liquid_autotest_same_data(ptr noundef %21, ptr noundef %24, i32 noundef %65)
  %67 = icmp ne i32 %66, 0
  br i1 %67, label %81, label %68

68:                                               ; preds = %49
  call void @liquid_autotest_failed_msg(ptr noundef @.str.1, i32 noundef 120, ptr noundef @.str.5)
  %69 = load i32, ptr @liquid_autotest_verbose, align 4, !tbaa !5
  %70 = icmp ne i32 %69, 0
  br i1 %70, label %71, label %80

71:                                               ; preds = %68
  %72 = load i32, ptr %2, align 4, !tbaa !5
  %73 = zext i32 %72 to i64
  %74 = mul i64 %73, 8
  %75 = trunc i64 %74 to i32
  call void @liquid_autotest_print_array(ptr noundef %21, i32 noundef %75)
  %76 = load i32, ptr %2, align 4, !tbaa !5
  %77 = zext i32 %76 to i64
  %78 = mul i64 %77, 8
  %79 = trunc i64 %78 to i32
  call void @liquid_autotest_print_array(ptr noundef %24, i32 noundef %79)
  br label %80

80:                                               ; preds = %71, %68
  br label %82

81:                                               ; preds = %49
  call void (...) @liquid_autotest_passed()
  br label %82

82:                                               ; preds = %81, %80
  call void @llvm.lifetime.end.p0(i64 1, ptr %13) #4
  br label %83

83:                                               ; preds = %82
  %84 = load i32, ptr %10, align 4, !tbaa !5
  %85 = add i32 %84, 1
  store i32 %85, ptr %10, align 4, !tbaa !5
  br label %45, !llvm.loop !16

86:                                               ; preds = %45
  %87 = load ptr, ptr %9, align 8, !tbaa !11
  %88 = call i32 @msequence_destroy(ptr noundef %87)
  %89 = load ptr, ptr %4, align 8, !tbaa !11
  %90 = call i32 @fskmod_destroy(ptr noundef %89)
  %91 = load ptr, ptr %12, align 8, !tbaa !11
  %92 = call i32 @fskmod_destroy(ptr noundef %91)
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  %93 = load ptr, ptr %6, align 8
  call void @llvm.stackrestore.p0(ptr %93)
  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 ptr @msequence_create_default(i32 noundef) #1

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

declare ptr @fskmod_copy(ptr noundef) #1

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

declare void @liquid_autotest_failed_msg(ptr noundef, i32 noundef, ptr noundef) #1

declare void @liquid_autotest_print_array(ptr noundef, i32 noundef) #1

declare i32 @msequence_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 = { 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 = !{!7, !7, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = distinct !{!16, !15}


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

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

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

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

declare i32 @fskmod_destroy(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local void @autotest_fskmod_copy() local_unnamed_addr #1 {
  %1 = tail call ptr @fskmod_create(i32 noundef 3, i32 noundef 200, float noundef 0x3FCE0418A0000000) #2
  %2 = alloca [200 x { float, float }], align 16
  %3 = alloca [200 x { float, float }], align 16
  %4 = tail call ptr @msequence_create_default(i32 noundef 7) #2
  br label %5

5:                                                ; preds = %0, %5
  %.029 = phi i32 [ 0, %0 ], [ %9, %5 ]
  %6 = call i32 @msequence_generate_symbol(ptr noundef %4, i32 noundef 3) #2
  %7 = and i32 %6, 255
  %8 = call i32 @fskmod_modulate(ptr noundef %1, i32 noundef %7, ptr noundef nonnull %2) #2
  %9 = add nuw nsw i32 %.029, 1
  %exitcond.not = icmp eq i32 %9, 96
  br i1 %exitcond.not, label %10, label %5, !llvm.loop !5

10:                                               ; preds = %5
  %11 = call ptr @fskmod_copy(ptr noundef %1) #2
  br label %12

12:                                               ; preds = %10, %22
  %.130 = phi i32 [ 0, %10 ], [ %23, %22 ]
  %13 = call i32 @msequence_generate_symbol(ptr noundef %4, i32 noundef 3) #2
  %14 = and i32 %13, 255
  %15 = call i32 @fskmod_modulate(ptr noundef %1, i32 noundef %14, ptr noundef nonnull %2) #2
  %16 = call i32 @fskmod_modulate(ptr noundef %11, i32 noundef %14, ptr noundef nonnull %3) #2
  %17 = call i32 @liquid_autotest_same_data(ptr noundef nonnull %2, ptr noundef nonnull %3, i32 noundef 1600) #2
  %.not = icmp eq i32 %17, 0
  br i1 %.not, label %18, label %21

18:                                               ; preds = %12
  call void @liquid_autotest_failed_msg(ptr noundef nonnull @.str.1, i32 noundef 120, ptr noundef nonnull @.str.5) #2
  %19 = load i32, ptr @liquid_autotest_verbose, align 4, !tbaa !7
  %.not28 = icmp eq i32 %19, 0
  br i1 %.not28, label %22, label %20

20:                                               ; preds = %18
  call void @liquid_autotest_print_array(ptr noundef nonnull %2, i32 noundef 1600) #2
  call void @liquid_autotest_print_array(ptr noundef nonnull %3, i32 noundef 1600) #2
  br label %22

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

22:                                               ; preds = %18, %20, %21
  %23 = add nuw nsw i32 %.130, 1
  %exitcond31.not = icmp eq i32 %23, 96
  br i1 %exitcond31.not, label %24, label %12, !llvm.loop !11

24:                                               ; preds = %22
  %25 = call i32 @msequence_destroy(ptr noundef %4) #2
  %26 = call i32 @fskmod_destroy(ptr noundef %1) #2
  %27 = call i32 @fskmod_destroy(ptr noundef %11) #2
  ret void
}

declare ptr @msequence_create_default(i32 noundef) local_unnamed_addr #0

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

declare ptr @fskmod_copy(ptr noundef) local_unnamed_addr #0

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

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

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

declare i32 @msequence_destroy(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 = !{!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,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,LoopRotatePass,SROAPass,SimplifyCFGPass,TailCallElimPass