; 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.62 = external hidden unnamed_addr constant [54 x i8], align 1
@.str.63 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.64 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.65 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.66 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.67 = external hidden unnamed_addr constant [3 x i8], align 1

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

; Function Attrs: nounwind uwtable
define dso_local i32 @cpfskdem_print(ptr noundef %0) #1 {
  %2 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %3 = load ptr, ptr %2, align 8, !tbaa !5
  %4 = getelementptr inbounds %struct.cpfskdem_s, ptr %3, i32 0, i32 0
  %5 = load i32, ptr %4, align 8, !tbaa !9
  %6 = load ptr, ptr %2, align 8, !tbaa !5
  %7 = getelementptr inbounds %struct.cpfskdem_s, ptr %6, i32 0, i32 4
  %8 = load float, ptr %7, align 8, !tbaa !13
  %9 = fpext float %8 to double
  %10 = load ptr, ptr %2, align 8, !tbaa !5
  %11 = getelementptr inbounds %struct.cpfskdem_s, ptr %10, i32 0, i32 1
  %12 = load i32, ptr %11, align 4, !tbaa !14
  %13 = load ptr, ptr %2, align 8, !tbaa !5
  %14 = getelementptr inbounds %struct.cpfskdem_s, ptr %13, i32 0, i32 2
  %15 = load i32, ptr %14, align 8, !tbaa !15
  %16 = load ptr, ptr %2, align 8, !tbaa !5
  %17 = getelementptr inbounds %struct.cpfskdem_s, ptr %16, i32 0, i32 3
  %18 = load float, ptr %17, align 4, !tbaa !16
  %19 = fpext float %18 to double
  %20 = call i32 (ptr, ...) @printf(ptr noundef @.str.62, i32 noundef %5, double noundef %9, i32 noundef %12, i32 noundef %15, double noundef %19)
  %21 = load ptr, ptr %2, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct.cpfskdem_s, ptr %21, i32 0, i32 5
  %23 = load i32, ptr %22, align 4, !tbaa !17
  switch i32 %23, label %32 [
    i32 0, label %24
    i32 1, label %26
    i32 2, label %28
    i32 3, label %30
  ]

24:                                               ; preds = %1
  %25 = call i32 (ptr, ...) @printf(ptr noundef @.str.63)
  br label %33

26:                                               ; preds = %1
  %27 = call i32 (ptr, ...) @printf(ptr noundef @.str.64)
  br label %33

28:                                               ; preds = %1
  %29 = call i32 (ptr, ...) @printf(ptr noundef @.str.65)
  br label %33

30:                                               ; preds = %1
  %31 = call i32 (ptr, ...) @printf(ptr noundef @.str.66)
  br label %33

32:                                               ; preds = %1
  br label %33

33:                                               ; preds = %32, %30, %28, %26, %24
  %34 = call i32 (ptr, ...) @printf(ptr noundef @.str.67)
  ret i32 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" }

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


; 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.62 = external hidden unnamed_addr constant [54 x i8], align 1
@.str.63 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.64 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.65 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.66 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.67 = external hidden unnamed_addr constant [3 x i8], align 1
@switch.table.cpfskdem_print = private unnamed_addr constant [4 x ptr] [ptr @.str.63, ptr @.str.64, ptr @.str.65, ptr @.str.66], align 8

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

; Function Attrs: nofree nounwind uwtable
define dso_local noundef i32 @cpfskdem_print(ptr nocapture noundef readonly %0) local_unnamed_addr #1 {
  %2 = load i32, ptr %0, align 8, !tbaa !5
  %3 = getelementptr inbounds i8, ptr %0, i64 16
  %4 = load float, ptr %3, align 8, !tbaa !12
  %5 = fpext float %4 to double
  %6 = getelementptr inbounds i8, ptr %0, i64 4
  %7 = load i32, ptr %6, align 4, !tbaa !13
  %8 = getelementptr inbounds i8, ptr %0, i64 8
  %9 = load i32, ptr %8, align 8, !tbaa !14
  %10 = getelementptr inbounds i8, ptr %0, i64 12
  %11 = load float, ptr %10, align 4, !tbaa !15
  %12 = fpext float %11 to double
  %13 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.62, i32 noundef %2, double noundef %5, i32 noundef %7, i32 noundef %9, double noundef %12)
  %14 = getelementptr inbounds i8, ptr %0, i64 20
  %15 = load i32, ptr %14, align 4, !tbaa !16
  %16 = icmp ult i32 %15, 4
  br i1 %16, label %switch.lookup, label %19

switch.lookup:                                    ; preds = %1
  %17 = zext nneg i32 %15 to i64
  %switch.gep = getelementptr inbounds [4 x ptr], ptr @switch.table.cpfskdem_print, i64 0, i64 %17
  %switch.load = load ptr, ptr %switch.gep, align 8
  %18 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %switch.load)
  br label %19

19:                                               ; preds = %1, %switch.lookup
  %20 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.67)
  ret i32 0
}

attributes #0 = { 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 #1 = { nofree 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" }

!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}


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