; 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_peak_node_config = type { %struct.ma_node_config, %struct.ma_peak2_config }
%struct.ma_peak2_config = type { i32, i32, i32, double, double, double }
%struct.ma_peak_node = type { %struct.ma_node_base, %struct.ma_peak2 }
%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_peak2 = type { %struct.ma_biquad }
%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 }

@_ZL21g_ma_peak_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_peak2_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
declare dso_local void @ma_node_uninit(ptr noundef, ptr noundef) #3

; Function Attrs: mustprogress uwtable
define dso_local i32 @ma_peak_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 %62

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 %62

22:                                               ; preds = %17
  %23 = load ptr, ptr %7, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct.ma_peak_node_config, ptr %23, i32 0, i32 1
  %25 = getelementptr inbounds %struct.ma_peak2_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 %62

29:                                               ; preds = %22
  %30 = load ptr, ptr %7, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.ma_peak_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_peak_node, ptr %33, i32 0, i32 1
  %35 = call i32 @ma_peak2_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 %42

38:                                               ; preds = %29
  %39 = load ptr, ptr %9, align 8, !tbaa !5
  %40 = load ptr, ptr %8, align 8, !tbaa !5
  call void @ma_node_uninit(ptr noundef %39, ptr noundef %40)
  %41 = load i32, ptr %10, align 4, !tbaa !17
  store i32 %41, ptr %5, align 4
  store i32 1, ptr %12, align 4
  br label %62

42:                                               ; 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
  %43 = getelementptr inbounds %struct.ma_node_config, ptr %11, i32 0, i32 0
  store ptr @_ZL21g_ma_peak_node_vtable, ptr %43, align 8, !tbaa !22
  %44 = load ptr, ptr %7, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct.ma_peak_node_config, ptr %44, i32 0, i32 1
  %46 = getelementptr inbounds %struct.ma_peak2_config, ptr %45, i32 0, i32 1
  %47 = getelementptr inbounds %struct.ma_node_config, ptr %11, i32 0, i32 4
  store ptr %46, ptr %47, align 8, !tbaa !23
  %48 = load ptr, ptr %7, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct.ma_peak_node_config, ptr %48, i32 0, i32 1
  %50 = getelementptr inbounds %struct.ma_peak2_config, ptr %49, i32 0, i32 1
  %51 = getelementptr inbounds %struct.ma_node_config, ptr %11, i32 0, i32 5
  store ptr %50, ptr %51, align 8, !tbaa !24
  %52 = load ptr, ptr %6, align 8, !tbaa !5
  %53 = load ptr, ptr %8, align 8, !tbaa !5
  %54 = load ptr, ptr %9, align 8, !tbaa !5
  %55 = call i32 @ma_node_init(ptr noundef %52, ptr noundef %11, ptr noundef %53, ptr noundef %54)
  store i32 %55, ptr %10, align 4, !tbaa !17
  %56 = load i32, ptr %10, align 4, !tbaa !17
  %57 = icmp ne i32 %56, 0
  br i1 %57, label %58, label %60

58:                                               ; preds = %42
  %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 %62

60:                                               ; preds = %42
  %61 = load i32, ptr %10, align 4, !tbaa !17
  store i32 %61, ptr %5, align 4
  store i32 1, ptr %12, align 4
  br label %62

62:                                               ; preds = %60, %58, %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
  %63 = load i32, ptr %5, align 4
  ret i32 %63
}

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 = !{!"_ZTS19ma_peak_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 = !{!"_ZTS15ma_peak2_config", !15, i64 0, !13, i64 4, !13, i64 8, !16, i64 16, !16, i64 24, !16, i64 32}
!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 }

@_ZL21g_ma_peak_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_peak2_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
declare dso_local void @ma_node_uninit(ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
define dso_local i32 @ma_peak_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 %21, 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 %21, 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 %21

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

15:                                               ; preds = %12
  tail call void @ma_node_uninit(ptr noundef nonnull %3, ptr noundef %2)
  br label %21

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

21:                                               ; preds = %16, %9, %7, %4, %15
  %.0 = phi i32 [ %14, %15 ], [ -2, %4 ], [ -2, %7 ], [ -2, %9 ], [ %20, %16 ]
  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 = !{!"_ZTS19ma_peak_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 = !{!"_ZTS15ma_peak2_config", !14, i64 0, !12, i64 4, !12, i64 8, !15, i64 16, !15, i64 24, !15, i64 32}
!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