; LLVM IR from SelfishOlex/MiniAudioO3DE :: MiniAudio/Code/Source/Clients (MiniAudioImplementation)

; 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.ma_node_vtable = type { ptr, ptr, i8, i8, i32 }
%struct.ma_node_config = type { ptr, i32, i32, i32, ptr, ptr }
%struct.ma_biquad_node_config = type { %struct.ma_node_config, %struct.ma_biquad_config }
%struct.ma_biquad_config = type { i32, i32, double, double, double, double, double, double }
%struct.ma_biquad_node = type { %struct.ma_node_base, %struct.ma_biquad }
%struct.ma_node_base = type { ptr, ptr, ptr, i16, i16, i16, i16, i32, [2 x i64], i64, i32, i32, ptr, ptr, [2 x %struct.ma_node_input_bus], [2 x %struct.ma_node_output_bus], ptr, i32 }
%struct.ma_node_input_bus = type { %struct.ma_node_output_bus, i32, i32, i8 }
%struct.ma_node_output_bus = type { ptr, i8, i8, i8, i32, i32, i32, i32, float, ptr, ptr, ptr }
%struct.ma_biquad = type { i32, i32, %union.ma_biquad_coefficient, %union.ma_biquad_coefficient, %union.ma_biquad_coefficient, %union.ma_biquad_coefficient, %union.ma_biquad_coefficient, ptr, ptr, ptr, i32 }
%union.ma_biquad_coefficient = type { float }

@_ZL23g_ma_biquad_node_vtable = external hidden global %struct.ma_node_vtable, align 8

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local i32 @ma_biquad_init(ptr noundef, ptr noundef, ptr noundef) #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @ma_node_config_init(ptr dead_on_unwind noalias writable sret(%struct.ma_node_config) align 8) #4

; Function Attrs: mustprogress uwtable
declare dso_local i32 @ma_node_init(ptr noundef, ptr noundef, ptr noundef, ptr noundef) #3

; Function Attrs: mustprogress uwtable
define dso_local i32 @ma_biquad_node_init(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3) #3 {
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca %struct.ma_node_config, align 8
  %12 = alloca i32, align 4
  %13 = alloca %struct.ma_node_config, align 8
  store ptr %0, ptr %6, align 8, !tbaa !5
  store ptr %1, ptr %7, align 8, !tbaa !5
  store ptr %2, ptr %8, align 8, !tbaa !5
  store ptr %3, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  call void @llvm.lifetime.start.p0(i64 40, ptr %11) #5
  %14 = load ptr, ptr %9, align 8, !tbaa !5
  %15 = icmp eq ptr %14, null
  br i1 %15, label %16, label %17

16:                                               ; preds = %4
  store i32 -2, ptr %5, align 4
  store i32 1, ptr %12, align 4
  br label %60

17:                                               ; preds = %4
  %18 = load ptr, ptr %9, align 8, !tbaa !5
  call void @llvm.memset.p0.i64(ptr align 8 %18, i8 0, i64 424, i1 false)
  %19 = load ptr, ptr %7, align 8, !tbaa !5
  %20 = icmp eq ptr %19, null
  br i1 %20, label %21, label %22

21:                                               ; preds = %17
  store i32 -2, ptr %5, align 4
  store i32 1, ptr %12, align 4
  br label %60

22:                                               ; preds = %17
  %23 = load ptr, ptr %7, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct.ma_biquad_node_config, ptr %23, i32 0, i32 1
  %25 = getelementptr inbounds %struct.ma_biquad_config, ptr %24, i32 0, i32 0
  %26 = load i32, ptr %25, align 8, !tbaa !9
  %27 = icmp ne i32 %26, 5
  br i1 %27, label %28, label %29

28:                                               ; preds = %22
  store i32 -2, ptr %5, align 4
  store i32 1, ptr %12, align 4
  br label %60

29:                                               ; preds = %22
  %30 = load ptr, ptr %7, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.ma_biquad_node_config, ptr %30, i32 0, i32 1
  %32 = load ptr, ptr %8, align 8, !tbaa !5
  %33 = load ptr, ptr %9, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.ma_biquad_node, ptr %33, i32 0, i32 1
  %35 = call i32 @ma_biquad_init(ptr noundef %31, ptr noundef %32, ptr noundef %34)
  store i32 %35, ptr %10, align 4, !tbaa !17
  %36 = load i32, ptr %10, align 4, !tbaa !17
  %37 = icmp ne i32 %36, 0
  br i1 %37, label %38, label %40

38:                                               ; preds = %29
  %39 = load i32, ptr %10, align 4, !tbaa !17
  store i32 %39, ptr %5, align 4
  store i32 1, ptr %12, align 4
  br label %60

40:                                               ; preds = %29
  call void @llvm.lifetime.start.p0(i64 40, ptr %13) #5
  call void @ma_node_config_init(ptr dead_on_unwind writable sret(%struct.ma_node_config) align 8 %13)
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %11, ptr align 8 %13, i64 40, i1 false), !tbaa.struct !19
  call void @llvm.lifetime.end.p0(i64 40, ptr %13) #5
  %41 = getelementptr inbounds %struct.ma_node_config, ptr %11, i32 0, i32 0
  store ptr @_ZL23g_ma_biquad_node_vtable, ptr %41, align 8, !tbaa !22
  %42 = load ptr, ptr %7, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.ma_biquad_node_config, ptr %42, i32 0, i32 1
  %44 = getelementptr inbounds %struct.ma_biquad_config, ptr %43, i32 0, i32 1
  %45 = getelementptr inbounds %struct.ma_node_config, ptr %11, i32 0, i32 4
  store ptr %44, ptr %45, align 8, !tbaa !23
  %46 = load ptr, ptr %7, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.ma_biquad_node_config, ptr %46, i32 0, i32 1
  %48 = getelementptr inbounds %struct.ma_biquad_config, ptr %47, i32 0, i32 1
  %49 = getelementptr inbounds %struct.ma_node_config, ptr %11, i32 0, i32 5
  store ptr %48, ptr %49, align 8, !tbaa !24
  %50 = load ptr, ptr %6, align 8, !tbaa !5
  %51 = load ptr, ptr %8, align 8, !tbaa !5
  %52 = load ptr, ptr %9, align 8, !tbaa !5
  %53 = call i32 @ma_node_init(ptr noundef %50, ptr noundef %11, ptr noundef %51, ptr noundef %52)
  store i32 %53, ptr %10, align 4, !tbaa !17
  %54 = load i32, ptr %10, align 4, !tbaa !17
  %55 = icmp ne i32 %54, 0
  br i1 %55, label %56, label %58

56:                                               ; preds = %40
  %57 = load i32, ptr %10, align 4, !tbaa !17
  store i32 %57, ptr %5, align 4
  store i32 1, ptr %12, align 4
  br label %60

58:                                               ; preds = %40
  %59 = load i32, ptr %10, align 4, !tbaa !17
  store i32 %59, ptr %5, align 4
  store i32 1, ptr %12, align 4
  br label %60

60:                                               ; preds = %58, %56, %38, %28, %21, %16
  call void @llvm.lifetime.end.p0(i64 40, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  %61 = load i32, ptr %5, align 4
  ret i32 %61
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { mustprogress 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 = { mustprogress 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 #5 = { 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++ TBAA"}
!9 = !{!10, !15, i64 40}
!10 = !{!"_ZTS21ma_biquad_node_config", !11, i64 0, !14, i64 40}
!11 = !{!"_ZTS14ma_node_config", !6, i64 0, !12, i64 8, !13, i64 12, !13, i64 16, !6, i64 24, !6, i64 32}
!12 = !{!"_ZTS13ma_node_state", !7, i64 0}
!13 = !{!"int", !7, i64 0}
!14 = !{!"_ZTS16ma_biquad_config", !15, i64 0, !13, i64 4, !16, i64 8, !16, i64 16, !16, i64 24, !16, i64 32, !16, i64 40, !16, i64 48}
!15 = !{!"_ZTS9ma_format", !7, i64 0}
!16 = !{!"double", !7, i64 0}
!17 = !{!18, !18, i64 0}
!18 = !{!"_ZTS9ma_result", !7, i64 0}
!19 = !{i64 0, i64 8, !5, i64 8, i64 4, !20, i64 12, i64 4, !21, i64 16, i64 4, !21, i64 24, i64 8, !5, i64 32, i64 8, !5}
!20 = !{!12, !12, i64 0}
!21 = !{!13, !13, i64 0}
!22 = !{!11, !6, i64 0}
!23 = !{!11, !6, i64 24}
!24 = !{!11, !6, i64 32}


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

%struct.ma_node_vtable = type { ptr, ptr, i8, i8, i32 }
%struct.ma_node_config = type { ptr, i32, i32, i32, ptr, ptr }

@_ZL23g_ma_biquad_node_vtable = external hidden global %struct.ma_node_vtable, align 8

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local i32 @ma_biquad_init(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @ma_node_config_init(ptr dead_on_unwind noalias writable sret(%struct.ma_node_config) align 8) local_unnamed_addr #3

; Function Attrs: mustprogress uwtable
declare dso_local i32 @ma_node_init(ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
define dso_local i32 @ma_biquad_node_init(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3) local_unnamed_addr #2 {
  %5 = alloca %struct.ma_node_config, align 8
  call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %5) #4
  %6 = icmp eq ptr %3, null
  br i1 %6, label %20, label %7

7:                                                ; preds = %4
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(424) %3, i8 0, i64 424, i1 false)
  %8 = icmp eq ptr %1, null
  br i1 %8, label %20, label %9

9:                                                ; preds = %7
  %10 = getelementptr inbounds i8, ptr %1, i64 40
  %11 = load i32, ptr %10, align 8, !tbaa !5
  %.not = icmp eq i32 %11, 5
  br i1 %.not, label %12, label %20

12:                                               ; preds = %9
  %13 = getelementptr inbounds i8, ptr %3, i64 360
  %14 = tail call i32 @ma_biquad_init(ptr noundef nonnull %10, ptr noundef %2, ptr noundef nonnull %13)
  %.not21 = icmp eq i32 %14, 0
  br i1 %.not21, label %15, label %20

15:                                               ; preds = %12
  call void @ma_node_config_init(ptr dead_on_unwind nonnull writable sret(%struct.ma_node_config) align 8 %5)
  store ptr @_ZL23g_ma_biquad_node_vtable, ptr %5, align 8, !tbaa !16
  %16 = getelementptr inbounds i8, ptr %1, i64 44
  %17 = getelementptr inbounds i8, ptr %5, i64 24
  store ptr %16, ptr %17, align 8, !tbaa !17
  %18 = getelementptr inbounds i8, ptr %5, i64 32
  store ptr %16, ptr %18, align 8, !tbaa !18
  %19 = call i32 @ma_node_init(ptr noundef %0, ptr noundef nonnull %5, ptr noundef %2, ptr noundef nonnull %3)
  br label %20

20:                                               ; preds = %15, %12, %9, %7, %4
  %.0 = phi i32 [ -2, %4 ], [ -2, %7 ], [ -2, %9 ], [ %14, %12 ], [ %19, %15 ]
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %5) #4
  ret i32 %.0
}

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #2 = { mustprogress 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 = { mustprogress 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, !14, i64 40}
!6 = !{!"_ZTS21ma_biquad_node_config", !7, i64 0, !13, i64 40}
!7 = !{!"_ZTS14ma_node_config", !8, i64 0, !11, i64 8, !12, i64 12, !12, i64 16, !8, i64 24, !8, i64 32}
!8 = !{!"any pointer", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = !{!"_ZTS13ma_node_state", !9, i64 0}
!12 = !{!"int", !9, i64 0}
!13 = !{!"_ZTS16ma_biquad_config", !14, i64 0, !12, i64 4, !15, i64 8, !15, i64 16, !15, i64 24, !15, i64 32, !15, i64 40, !15, i64 48}
!14 = !{!"_ZTS9ma_format", !9, i64 0}
!15 = !{!"double", !9, i64 0}
!16 = !{!7, !8, i64 0}
!17 = !{!7, !8, i64 24}
!18 = !{!7, !8, i64 32}


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