; 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.modemcf_s = type { i32, i32, i32, [8 x float], ptr, i32, { float, float }, { float, float }, %union.anon, ptr, ptr, ptr, i32 }
%union.anon = type { %struct.anon.3 }
%struct.anon.3 = type { i32, [8 x i32], [8 x float], [8 x float], [8 x float], ptr }

@.str = external hidden unnamed_addr constant [89 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [54 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [59 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @modemcf_init(ptr noundef %0, i32 noundef %1) #0 {
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store i32 %1, ptr %5, align 4, !tbaa !9
  %6 = load i32, ptr %5, align 4, !tbaa !9
  %7 = icmp ult i32 %6, 1
  br i1 %7, label %8, label %10

8:                                                ; preds = %2
  %9 = call i32 (i32, ptr, i32, ptr, ...) @liquid_error_fl(i32 noundef 3, ptr noundef @.str, i32 noundef 327, ptr noundef @.str.6, ptr noundef @.str.2)
  store i32 %9, ptr %3, align 4
  br label %37

10:                                               ; preds = %2
  %11 = load i32, ptr %5, align 4, !tbaa !9
  %12 = icmp ugt i32 %11, 8
  br i1 %12, label %13, label %15

13:                                               ; preds = %10
  %14 = call i32 (i32, ptr, i32, ptr, ...) @liquid_error_fl(i32 noundef 3, ptr noundef @.str, i32 noundef 329, ptr noundef @.str.7, ptr noundef @.str.2)
  store i32 %14, ptr %3, align 4
  br label %37

15:                                               ; preds = %10
  %16 = load ptr, ptr %4, align 8, !tbaa !5
  %17 = getelementptr inbounds %struct.modemcf_s, ptr %16, i32 0, i32 4
  store ptr null, ptr %17, align 8, !tbaa !11
  %18 = load ptr, ptr %4, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct.modemcf_s, ptr %18, i32 0, i32 5
  store i32 0, ptr %19, align 8, !tbaa !13
  %20 = load i32, ptr %5, align 4, !tbaa !9
  %21 = load ptr, ptr %4, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct.modemcf_s, ptr %21, i32 0, i32 1
  store i32 %20, ptr %22, align 4, !tbaa !14
  %23 = load ptr, ptr %4, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct.modemcf_s, ptr %23, i32 0, i32 1
  %25 = load i32, ptr %24, align 4, !tbaa !14
  %26 = shl i32 1, %25
  %27 = load ptr, ptr %4, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.modemcf_s, ptr %27, i32 0, i32 2
  store i32 %26, ptr %28, align 8, !tbaa !15
  %29 = load ptr, ptr %4, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.modemcf_s, ptr %29, i32 0, i32 9
  store ptr null, ptr %30, align 8, !tbaa !16
  %31 = load ptr, ptr %4, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.modemcf_s, ptr %31, i32 0, i32 10
  store ptr null, ptr %32, align 8, !tbaa !17
  %33 = load ptr, ptr %4, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.modemcf_s, ptr %33, i32 0, i32 11
  store ptr null, ptr %34, align 8, !tbaa !18
  %35 = load ptr, ptr %4, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct.modemcf_s, ptr %35, i32 0, i32 12
  store i32 0, ptr %36, align 8, !tbaa !19
  store i32 0, ptr %3, align 4
  br label %37

37:                                               ; preds = %15, %13, %8
  %38 = load i32, ptr %3, align 4
  ret i32 %38
}

declare i32 @liquid_error_fl(i32 noundef, ptr noundef, i32 noundef, ptr noundef, ...) #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" }

!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 = !{!12, !6, i64 48}
!12 = !{!"modemcf_s", !10, i64 0, !10, i64 4, !10, i64 8, !7, i64 12, !6, i64 48, !10, i64 56, !7, i64 60, !7, i64 68, !7, i64 80, !6, i64 224, !6, i64 232, !6, i64 240, !10, i64 248}
!13 = !{!12, !10, i64 56}
!14 = !{!12, !10, i64 4}
!15 = !{!12, !10, i64 8}
!16 = !{!12, !6, i64 224}
!17 = !{!12, !6, i64 232}
!18 = !{!12, !6, i64 240}
!19 = !{!12, !10, i64 248}


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

; Function Attrs: nounwind uwtable
define dso_local i32 @modemcf_init(ptr nocapture noundef writeonly %0, i32 noundef %1) local_unnamed_addr #0 {
  %3 = icmp eq i32 %1, 0
  br i1 %3, label %4, label %6

4:                                                ; preds = %2
  %5 = tail call i32 (i32, ptr, i32, ptr, ...) @liquid_error_fl(i32 noundef 3, ptr noundef nonnull @.str, i32 noundef 327, ptr noundef nonnull @.str.6, ptr noundef nonnull @.str.2) #3
  br label %17

6:                                                ; preds = %2
  %7 = icmp ugt i32 %1, 8
  br i1 %7, label %8, label %10

8:                                                ; preds = %6
  %9 = tail call i32 (i32, ptr, i32, ptr, ...) @liquid_error_fl(i32 noundef 3, ptr noundef nonnull @.str, i32 noundef 329, ptr noundef nonnull @.str.7, ptr noundef nonnull @.str.2) #3
  br label %17

10:                                               ; preds = %6
  %11 = getelementptr inbounds i8, ptr %0, i64 48
  store ptr null, ptr %11, align 8, !tbaa !5
  %12 = getelementptr inbounds i8, ptr %0, i64 56
  store i32 0, ptr %12, align 8, !tbaa !11
  %13 = getelementptr inbounds i8, ptr %0, i64 4
  store i32 %1, ptr %13, align 4, !tbaa !12
  %14 = shl nuw nsw i32 1, %1
  %15 = getelementptr inbounds i8, ptr %0, i64 8
  store i32 %14, ptr %15, align 8, !tbaa !13
  %16 = getelementptr inbounds i8, ptr %0, i64 224
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(28) %16, i8 0, i64 28, i1 false)
  br label %17

17:                                               ; preds = %10, %8, %4
  %.0 = phi i32 [ %5, %4 ], [ %9, %8 ], [ 0, %10 ]
  ret i32 %.0
}

declare i32 @liquid_error_fl(i32 noundef, ptr noundef, i32 noundef, ptr noundef, ...) local_unnamed_addr #1

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2

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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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, !10, i64 48}
!6 = !{!"modemcf_s", !7, i64 0, !7, i64 4, !7, i64 8, !8, i64 12, !10, i64 48, !7, i64 56, !8, i64 60, !8, i64 68, !8, i64 80, !10, i64 224, !10, i64 232, !10, i64 240, !7, i64 248}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!6, !7, i64 56}
!12 = !{!6, !7, i64 4}
!13 = !{!6, !7, i64 8}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InstCombinePass,MemCpyOptPass,PostOrderFunctionAttrsPass,SROAPass,TailCallElimPass