; 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 }
%struct.anon.0 = type { float, float, float }
%struct.anon.6 = type { float }

@.str = external hidden unnamed_addr constant [89 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [38 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local ptr @modemcf_create(i32 noundef) #0

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

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

8:                                                ; preds = %1
  %9 = call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef @.str, i32 noundef 238, ptr noundef @.str.4, ptr noundef @.str.2)
  store ptr %9, ptr %2, align 8
  br label %73

10:                                               ; preds = %1
  %11 = load ptr, ptr %3, align 8, !tbaa !5
  %12 = getelementptr inbounds %struct.modemcf_s, ptr %11, i32 0, i32 0
  %13 = load i32, ptr %12, align 8, !tbaa !9
  %14 = icmp eq i32 %13, 52
  br i1 %14, label %15, label %32

15:                                               ; preds = %10
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #4
  %16 = load ptr, ptr %3, align 8, !tbaa !5
  %17 = getelementptr inbounds %struct.modemcf_s, ptr %16, i32 0, i32 1
  %18 = load i32, ptr %17, align 4, !tbaa !12
  %19 = call ptr @modemcf_create_arb(i32 noundef %18)
  store ptr %19, ptr %4, align 8, !tbaa !5
  %20 = load ptr, ptr %4, align 8, !tbaa !5
  %21 = getelementptr inbounds %struct.modemcf_s, ptr %20, i32 0, i32 4
  %22 = load ptr, ptr %21, align 8, !tbaa !13
  %23 = load ptr, ptr %3, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct.modemcf_s, ptr %23, i32 0, i32 4
  %25 = load ptr, ptr %24, align 8, !tbaa !13
  %26 = load ptr, ptr %4, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.modemcf_s, ptr %26, i32 0, i32 2
  %28 = load i32, ptr %27, align 8, !tbaa !14
  %29 = zext i32 %28 to i64
  %30 = mul i64 %29, 8
  call void @llvm.memmove.p0.p0.i64(ptr align 4 %22, ptr align 4 %25, i64 %30, i1 false)
  %31 = load ptr, ptr %4, align 8, !tbaa !5
  store ptr %31, ptr %2, align 8
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #4
  br label %73

32:                                               ; preds = %10
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #4
  %33 = load ptr, ptr %3, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.modemcf_s, ptr %33, i32 0, i32 0
  %35 = load i32, ptr %34, align 8, !tbaa !9
  %36 = call ptr @modemcf_create(i32 noundef %35)
  store ptr %36, ptr %5, align 8, !tbaa !5
  %37 = load ptr, ptr %5, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.modemcf_s, ptr %37, i32 0, i32 0
  %39 = load i32, ptr %38, align 8, !tbaa !9
  switch i32 %39, label %70 [
    i32 9, label %40
    i32 10, label %40
    i32 11, label %40
    i32 12, label %40
    i32 13, label %40
    i32 14, label %40
    i32 15, label %40
    i32 16, label %40
    i32 51, label %62
  ]

40:                                               ; preds = %32, %32, %32, %32, %32, %32, %32, %32
  %41 = load ptr, ptr %3, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.modemcf_s, ptr %41, i32 0, i32 8
  %43 = getelementptr inbounds %struct.anon.0, ptr %42, i32 0, i32 0
  %44 = load float, ptr %43, align 8, !tbaa !15
  %45 = load ptr, ptr %5, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct.modemcf_s, ptr %45, i32 0, i32 8
  %47 = getelementptr inbounds %struct.anon.0, ptr %46, i32 0, i32 0
  store float %44, ptr %47, align 8, !tbaa !15
  %48 = load ptr, ptr %3, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct.modemcf_s, ptr %48, i32 0, i32 8
  %50 = getelementptr inbounds %struct.anon.0, ptr %49, i32 0, i32 1
  %51 = load float, ptr %50, align 4, !tbaa !15
  %52 = load ptr, ptr %5, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.modemcf_s, ptr %52, i32 0, i32 8
  %54 = getelementptr inbounds %struct.anon.0, ptr %53, i32 0, i32 1
  store float %51, ptr %54, align 4, !tbaa !15
  %55 = load ptr, ptr %3, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct.modemcf_s, ptr %55, i32 0, i32 8
  %57 = getelementptr inbounds %struct.anon.0, ptr %56, i32 0, i32 2
  %58 = load float, ptr %57, align 8, !tbaa !15
  %59 = load ptr, ptr %5, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct.modemcf_s, ptr %59, i32 0, i32 8
  %61 = getelementptr inbounds %struct.anon.0, ptr %60, i32 0, i32 2
  store float %58, ptr %61, align 8, !tbaa !15
  br label %71

62:                                               ; preds = %32
  %63 = load ptr, ptr %3, align 8, !tbaa !5
  %64 = getelementptr inbounds %struct.modemcf_s, ptr %63, i32 0, i32 8
  %65 = getelementptr inbounds %struct.anon.6, ptr %64, i32 0, i32 0
  %66 = load float, ptr %65, align 8, !tbaa !15
  %67 = load ptr, ptr %5, align 8, !tbaa !5
  %68 = getelementptr inbounds %struct.modemcf_s, ptr %67, i32 0, i32 8
  %69 = getelementptr inbounds %struct.anon.6, ptr %68, i32 0, i32 0
  store float %66, ptr %69, align 8, !tbaa !15
  br label %71

70:                                               ; preds = %32
  br label %71

71:                                               ; preds = %70, %62, %40
  %72 = load ptr, ptr %5, align 8, !tbaa !5
  store ptr %72, ptr %2, align 8
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #4
  br label %73

73:                                               ; preds = %71, %15, %8
  %74 = load ptr, ptr %2, align 8
  ret ptr %74
}

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

; Function Attrs: nounwind uwtable
declare dso_local ptr @modemcf_create_arb(i32 noundef) #0

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memmove.p0.p0.i64(ptr nocapture writeonly, ptr nocapture readonly, i64, i1 immarg) #3

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #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 nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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, !11, i64 0}
!10 = !{!"modemcf_s", !11, i64 0, !11, i64 4, !11, i64 8, !7, i64 12, !6, i64 48, !11, i64 56, !7, i64 60, !7, i64 68, !7, i64 80, !6, i64 224, !6, i64 232, !6, i64 240, !11, i64 248}
!11 = !{!"int", !7, i64 0}
!12 = !{!10, !11, i64 4}
!13 = !{!10, !6, i64 48}
!14 = !{!10, !11, i64 8}
!15 = !{!7, !7, i64 0}


; 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.4 = external hidden unnamed_addr constant [38 x i8], align 1

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

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

; Function Attrs: nounwind uwtable
define dso_local ptr @modemcf_copy(ptr noundef readonly %0) local_unnamed_addr #0 {
  %2 = icmp eq ptr %0, null
  br i1 %2, label %3, label %5

3:                                                ; preds = %1
  %4 = tail call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef nonnull @.str, i32 noundef 238, ptr noundef nonnull @.str.4, ptr noundef nonnull @.str.2) #3
  br label %37

5:                                                ; preds = %1
  %6 = load i32, ptr %0, align 8, !tbaa !5
  %7 = icmp eq i32 %6, 52
  br i1 %7, label %8, label %20

8:                                                ; preds = %5
  %9 = getelementptr inbounds i8, ptr %0, i64 4
  %10 = load i32, ptr %9, align 4, !tbaa !11
  %11 = tail call ptr @modemcf_create_arb(i32 noundef %10)
  %12 = getelementptr inbounds i8, ptr %11, i64 48
  %13 = load ptr, ptr %12, align 8, !tbaa !12
  %14 = getelementptr inbounds i8, ptr %0, i64 48
  %15 = load ptr, ptr %14, align 8, !tbaa !12
  %16 = getelementptr inbounds i8, ptr %11, i64 8
  %17 = load i32, ptr %16, align 8, !tbaa !13
  %18 = zext i32 %17 to i64
  %19 = shl nuw nsw i64 %18, 3
  tail call void @llvm.memmove.p0.p0.i64(ptr align 4 %13, ptr align 4 %15, i64 %19, i1 false)
  br label %37

20:                                               ; preds = %5
  %21 = tail call ptr @modemcf_create(i32 noundef %6)
  %22 = load i32, ptr %21, align 8, !tbaa !5
  switch i32 %22, label %37 [
    i32 9, label %23
    i32 10, label %23
    i32 11, label %23
    i32 12, label %23
    i32 13, label %23
    i32 14, label %23
    i32 15, label %23
    i32 16, label %23
    i32 51, label %33
  ]

23:                                               ; preds = %20, %20, %20, %20, %20, %20, %20, %20
  %24 = getelementptr inbounds i8, ptr %0, i64 80
  %25 = load float, ptr %24, align 8, !tbaa !14
  %26 = getelementptr inbounds i8, ptr %21, i64 80
  store float %25, ptr %26, align 8, !tbaa !14
  %27 = getelementptr inbounds i8, ptr %0, i64 84
  %28 = load float, ptr %27, align 4, !tbaa !14
  %29 = getelementptr inbounds i8, ptr %21, i64 84
  store float %28, ptr %29, align 4, !tbaa !14
  %30 = getelementptr inbounds i8, ptr %0, i64 88
  %31 = load float, ptr %30, align 8, !tbaa !14
  %32 = getelementptr inbounds i8, ptr %21, i64 88
  store float %31, ptr %32, align 8, !tbaa !14
  br label %37

33:                                               ; preds = %20
  %34 = getelementptr inbounds i8, ptr %0, i64 80
  %35 = load float, ptr %34, align 8, !tbaa !14
  %36 = getelementptr inbounds i8, ptr %21, i64 80
  store float %35, ptr %36, align 8, !tbaa !14
  br label %37

37:                                               ; preds = %23, %33, %20, %8, %3
  %.0 = phi ptr [ %4, %3 ], [ %11, %8 ], [ %21, %20 ], [ %21, %33 ], [ %21, %23 ]
  ret ptr %.0
}

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

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memmove.p0.p0.i64(ptr nocapture writeonly, ptr nocapture readonly, 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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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, !7, i64 0}
!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 4}
!12 = !{!6, !10, i64 48}
!13 = !{!6, !7, i64 8}
!14 = !{!8, !8, i64 0}


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