; LLVM IR from jgaeddert/liquid-dsp :: src/modem/src (modemcf)

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

%struct.cpfskdem_s = type { i32, i32, i32, float, float, i32, i32, i32, i32, ptr, %union.anon.7, i32, i32, { float, float } }
%union.anon.7 = type { %struct.anon.9 }
%struct.anon.9 = type { ptr }

@.str.49 = external hidden unnamed_addr constant [85 x i8], align 1
@.str.50 = external hidden unnamed_addr constant [54 x i8], align 1
@.str.51 = external hidden unnamed_addr constant [59 x i8], align 1
@.str.52 = external hidden unnamed_addr constant [66 x i8], align 1
@.str.53 = external hidden unnamed_addr constant [55 x i8], align 1
@.str.54 = external hidden unnamed_addr constant [52 x i8], align 1
@.str.55 = external hidden unnamed_addr constant [44 x i8], align 1
@stderr = external global ptr, align 8
@.str.56 = external hidden unnamed_addr constant [80 x i8], align 1

declare ptr @liquid_error_config_fl(ptr noundef, i32 noundef, ptr noundef, ...) #0

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

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

; Function Attrs: nounwind allocsize(0)
declare noalias ptr @malloc(i64 noundef) #2

; Function Attrs: nounwind uwtable
define dso_local ptr @cpfskdem_create(i32 noundef %0, float noundef %1, i32 noundef %2, i32 noundef %3, float noundef %4, i32 noundef %5) #3 {
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca float, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca float, align 4
  %13 = alloca i32, align 4
  %14 = alloca ptr, align 8
  store i32 %0, ptr %8, align 4, !tbaa !5
  store float %1, ptr %9, align 4, !tbaa !9
  store i32 %2, ptr %10, align 4, !tbaa !5
  store i32 %3, ptr %11, align 4, !tbaa !5
  store float %4, ptr %12, align 4, !tbaa !9
  store i32 %5, ptr %13, align 4, !tbaa !5
  %15 = load i32, ptr %8, align 4, !tbaa !5
  %16 = icmp eq i32 %15, 0
  br i1 %16, label %17, label %19

17:                                               ; preds = %6
  %18 = call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef @.str.49, i32 noundef 112, ptr noundef @.str.50)
  store ptr %18, ptr %7, align 8
  br label %91

19:                                               ; preds = %6
  %20 = load float, ptr %9, align 4, !tbaa !9
  %21 = fcmp ole float %20, 0.000000e+00
  br i1 %21, label %22, label %24

22:                                               ; preds = %19
  %23 = call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef @.str.49, i32 noundef 114, ptr noundef @.str.51)
  store ptr %23, ptr %7, align 8
  br label %91

24:                                               ; preds = %19
  %25 = load i32, ptr %10, align 4, !tbaa !5
  %26 = icmp ult i32 %25, 2
  br i1 %26, label %31, label %27

27:                                               ; preds = %24
  %28 = load i32, ptr %10, align 4, !tbaa !5
  %29 = urem i32 %28, 2
  %30 = icmp ne i32 %29, 0
  br i1 %30, label %31, label %33

31:                                               ; preds = %27, %24
  %32 = call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef @.str.49, i32 noundef 116, ptr noundef @.str.52)
  store ptr %32, ptr %7, align 8
  br label %91

33:                                               ; preds = %27
  %34 = load i32, ptr %11, align 4, !tbaa !5
  %35 = icmp eq i32 %34, 0
  br i1 %35, label %36, label %38

36:                                               ; preds = %33
  %37 = call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef @.str.49, i32 noundef 118, ptr noundef @.str.53)
  store ptr %37, ptr %7, align 8
  br label %91

38:                                               ; preds = %33
  %39 = load float, ptr %12, align 4, !tbaa !9
  %40 = fcmp ole float %39, 0.000000e+00
  br i1 %40, label %44, label %41

41:                                               ; preds = %38
  %42 = load float, ptr %12, align 4, !tbaa !9
  %43 = fcmp ogt float %42, 1.000000e+00
  br i1 %43, label %44, label %46

44:                                               ; preds = %41, %38
  %45 = call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef @.str.49, i32 noundef 120, ptr noundef @.str.54)
  store ptr %45, ptr %7, align 8
  br label %91

46:                                               ; preds = %41
  %47 = load i32, ptr %13, align 4, !tbaa !5
  switch i32 %47, label %49 [
    i32 0, label %48
    i32 1, label %48
    i32 2, label %48
    i32 3, label %48
  ]

48:                                               ; preds = %46, %46, %46, %46
  br label %52

49:                                               ; preds = %46
  %50 = load i32, ptr %13, align 4, !tbaa !5
  %51 = call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef @.str.49, i32 noundef 129, ptr noundef @.str.55, i32 noundef %50)
  store ptr %51, ptr %7, align 8
  br label %91

52:                                               ; preds = %48
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #5
  %53 = call noalias ptr @malloc(i64 noundef 72) #6
  store ptr %53, ptr %14, align 8, !tbaa !11
  %54 = load i32, ptr %8, align 4, !tbaa !5
  %55 = load ptr, ptr %14, align 8, !tbaa !11
  %56 = getelementptr inbounds %struct.cpfskdem_s, ptr %55, i32 0, i32 0
  store i32 %54, ptr %56, align 8, !tbaa !13
  %57 = load float, ptr %9, align 4, !tbaa !9
  %58 = load ptr, ptr %14, align 8, !tbaa !11
  %59 = getelementptr inbounds %struct.cpfskdem_s, ptr %58, i32 0, i32 4
  store float %57, ptr %59, align 8, !tbaa !15
  %60 = load i32, ptr %10, align 4, !tbaa !5
  %61 = load ptr, ptr %14, align 8, !tbaa !11
  %62 = getelementptr inbounds %struct.cpfskdem_s, ptr %61, i32 0, i32 1
  store i32 %60, ptr %62, align 4, !tbaa !16
  %63 = load i32, ptr %11, align 4, !tbaa !5
  %64 = load ptr, ptr %14, align 8, !tbaa !11
  %65 = getelementptr inbounds %struct.cpfskdem_s, ptr %64, i32 0, i32 2
  store i32 %63, ptr %65, align 8, !tbaa !17
  %66 = load float, ptr %12, align 4, !tbaa !9
  %67 = load ptr, ptr %14, align 8, !tbaa !11
  %68 = getelementptr inbounds %struct.cpfskdem_s, ptr %67, i32 0, i32 3
  store float %66, ptr %68, align 4, !tbaa !18
  %69 = load i32, ptr %13, align 4, !tbaa !5
  %70 = load ptr, ptr %14, align 8, !tbaa !11
  %71 = getelementptr inbounds %struct.cpfskdem_s, ptr %70, i32 0, i32 5
  store i32 %69, ptr %71, align 4, !tbaa !19
  %72 = load ptr, ptr %14, align 8, !tbaa !11
  %73 = getelementptr inbounds %struct.cpfskdem_s, ptr %72, i32 0, i32 0
  %74 = load i32, ptr %73, align 8, !tbaa !13
  %75 = shl i32 1, %74
  %76 = load ptr, ptr %14, align 8, !tbaa !11
  %77 = getelementptr inbounds %struct.cpfskdem_s, ptr %76, i32 0, i32 6
  store i32 %75, ptr %77, align 8, !tbaa !20
  %78 = load ptr, ptr %14, align 8, !tbaa !11
  %79 = getelementptr inbounds %struct.cpfskdem_s, ptr %78, i32 0, i32 4
  %80 = load float, ptr %79, align 8, !tbaa !15
  %81 = fcmp ogt float %80, 0x3FE5555C60000000
  br i1 %81, label %82, label %85

82:                                               ; preds = %52
  %83 = load ptr, ptr @stderr, align 8, !tbaa !11
  %84 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %83, ptr noundef @.str.56) #5
  br label %85

85:                                               ; preds = %82, %52
  %86 = load ptr, ptr %14, align 8, !tbaa !11
  %87 = call i32 @cpfskdem_init_noncoherent(ptr noundef %86)
  %88 = load ptr, ptr %14, align 8, !tbaa !11
  %89 = call i32 @cpfskdem_reset(ptr noundef %88)
  %90 = load ptr, ptr %14, align 8, !tbaa !11
  store ptr %90, ptr %7, align 8
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  br label %91

91:                                               ; preds = %85, %49, %44, %36, %31, %22, %17
  %92 = load ptr, ptr %7, align 8
  ret ptr %92
}

; Function Attrs: nounwind
declare i32 @fprintf(ptr noundef, ptr noundef, ...) #4

; Function Attrs: nounwind uwtable
declare dso_local i32 @cpfskdem_init_noncoherent(ptr noundef) #3

; Function Attrs: nounwind uwtable
declare dso_local i32 @cpfskdem_reset(ptr noundef) #3

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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nounwind allocsize(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 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 "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 #5 = { nounwind }
attributes #6 = { nounwind allocsize(0) }

!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 = !{!14, !6, i64 0}
!14 = !{!"cpfskdem_s", !6, i64 0, !6, i64 4, !6, i64 8, !10, i64 12, !10, i64 16, !6, i64 20, !6, i64 24, !6, i64 28, !6, i64 32, !12, i64 40, !7, i64 48, !6, i64 56, !6, i64 60, !7, i64 64}
!15 = !{!14, !10, i64 16}
!16 = !{!14, !6, i64 4}
!17 = !{!14, !6, i64 8}
!18 = !{!14, !10, i64 12}
!19 = !{!14, !6, i64 20}
!20 = !{!14, !6, i64 24}


; 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.49 = external hidden unnamed_addr constant [85 x i8], align 1
@.str.50 = external hidden unnamed_addr constant [54 x i8], align 1
@.str.51 = external hidden unnamed_addr constant [59 x i8], align 1
@.str.52 = external hidden unnamed_addr constant [66 x i8], align 1
@.str.53 = external hidden unnamed_addr constant [55 x i8], align 1
@.str.54 = external hidden unnamed_addr constant [52 x i8], align 1
@.str.55 = external hidden unnamed_addr constant [44 x i8], align 1
@stderr = external local_unnamed_addr global ptr, align 8
@.str.56 = external hidden unnamed_addr constant [80 x i8], align 1

declare ptr @liquid_error_config_fl(ptr noundef, i32 noundef, ptr noundef, ...) local_unnamed_addr #0

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local ptr @cpfskdem_create(i32 noundef %0, float noundef %1, i32 noundef %2, i32 noundef %3, float noundef %4, i32 noundef %5) local_unnamed_addr #2 {
  %7 = icmp eq i32 %0, 0
  br i1 %7, label %8, label %10

8:                                                ; preds = %6
  %9 = tail call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef nonnull @.str.49, i32 noundef 112, ptr noundef nonnull @.str.50) #4
  br label %47

10:                                               ; preds = %6
  %11 = fcmp ugt float %1, 0.000000e+00
  br i1 %11, label %14, label %12

12:                                               ; preds = %10
  %13 = tail call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef nonnull @.str.49, i32 noundef 114, ptr noundef nonnull @.str.51) #4
  br label %47

14:                                               ; preds = %10
  %15 = icmp ugt i32 %2, 1
  %16 = and i32 %2, 1
  %.not = icmp eq i32 %16, 0
  %or.cond33 = and i1 %15, %.not
  br i1 %or.cond33, label %19, label %17

17:                                               ; preds = %14
  %18 = tail call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef nonnull @.str.49, i32 noundef 116, ptr noundef nonnull @.str.52) #4
  br label %47

19:                                               ; preds = %14
  %20 = icmp eq i32 %3, 0
  br i1 %20, label %21, label %23

21:                                               ; preds = %19
  %22 = tail call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef nonnull @.str.49, i32 noundef 118, ptr noundef nonnull @.str.53) #4
  br label %47

23:                                               ; preds = %19
  %24 = fcmp ole float %4, 0.000000e+00
  %25 = fcmp ogt float %4, 1.000000e+00
  %or.cond = or i1 %24, %25
  br i1 %or.cond, label %26, label %28

26:                                               ; preds = %23
  %27 = tail call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef nonnull @.str.49, i32 noundef 120, ptr noundef nonnull @.str.54) #4
  br label %47

28:                                               ; preds = %23
  %switch = icmp ult i32 %5, 4
  br i1 %switch, label %31, label %29

29:                                               ; preds = %28
  %30 = tail call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef nonnull @.str.49, i32 noundef 129, ptr noundef nonnull @.str.55, i32 noundef %5) #4
  br label %47

31:                                               ; preds = %28
  %32 = tail call noalias dereferenceable_or_null(72) ptr @malloc(i64 noundef 72) #5
  store i32 %0, ptr %32, align 8, !tbaa !5
  %33 = getelementptr inbounds i8, ptr %32, i64 16
  store float %1, ptr %33, align 8, !tbaa !12
  %34 = getelementptr inbounds i8, ptr %32, i64 4
  store i32 %2, ptr %34, align 4, !tbaa !13
  %35 = getelementptr inbounds i8, ptr %32, i64 8
  store i32 %3, ptr %35, align 8, !tbaa !14
  %36 = getelementptr inbounds i8, ptr %32, i64 12
  store float %4, ptr %36, align 4, !tbaa !15
  %37 = getelementptr inbounds i8, ptr %32, i64 20
  store i32 %5, ptr %37, align 4, !tbaa !16
  %38 = shl nuw i32 1, %0
  %39 = getelementptr inbounds i8, ptr %32, i64 24
  store i32 %38, ptr %39, align 8, !tbaa !17
  %40 = fcmp ogt float %1, 0x3FE5555C60000000
  br i1 %40, label %41, label %44

41:                                               ; preds = %31
  %42 = load ptr, ptr @stderr, align 8, !tbaa !18
  %43 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %42, ptr noundef nonnull @.str.56) #6
  br label %44

44:                                               ; preds = %41, %31
  %45 = tail call i32 @cpfskdem_init_noncoherent(ptr noundef nonnull %32)
  %46 = tail call i32 @cpfskdem_reset(ptr noundef nonnull %32)
  br label %47

47:                                               ; preds = %44, %29, %26, %21, %17, %12, %8
  %.0 = phi ptr [ %9, %8 ], [ %13, %12 ], [ %18, %17 ], [ %22, %21 ], [ %27, %26 ], [ %30, %29 ], [ %32, %44 ]
  ret ptr %.0
}

; Function Attrs: nofree nounwind
declare noundef i32 @fprintf(ptr nocapture noundef, ptr nocapture noundef readonly, ...) local_unnamed_addr #3

; Function Attrs: nounwind uwtable
declare dso_local i32 @cpfskdem_init_noncoherent(ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare dso_local i32 @cpfskdem_reset(ptr noundef) local_unnamed_addr #2

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 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "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 = { 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 #4 = { nounwind }
attributes #5 = { nounwind allocsize(0) }
attributes #6 = { cold 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, !7, i64 0}
!6 = !{!"cpfskdem_s", !7, i64 0, !7, i64 4, !7, i64 8, !10, i64 12, !10, i64 16, !7, i64 20, !7, i64 24, !7, i64 28, !7, i64 32, !11, i64 40, !8, i64 48, !7, i64 56, !7, i64 60, !8, i64 64}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"float", !8, i64 0}
!11 = !{!"any pointer", !8, i64 0}
!12 = !{!6, !10, i64 16}
!13 = !{!6, !7, i64 4}
!14 = !{!6, !7, i64 8}
!15 = !{!6, !10, i64 12}
!16 = !{!6, !7, i64 20}
!17 = !{!6, !7, i64 24}
!18 = !{!11, !11, i64 0}


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