; 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_data_source_node_config = type { %struct.ma_node_config, ptr }
%struct.ma_data_source_node = type { %struct.ma_node_base, ptr }
%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 }

@.str.6 = external hidden unnamed_addr constant [104 x i8], align 1
@.str.160 = external hidden unnamed_addr constant [24 x i8], align 1
@__PRETTY_FUNCTION__.ma_data_source_node_init = external hidden unnamed_addr constant [144 x i8], align 1
@_ZL28g_ma_data_source_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: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #3

; Function Attrs: mustprogress uwtable
declare dso_local i32 @ma_data_source_get_data_format(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, i64 noundef) #4

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

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

17:                                               ; preds = %4
  store i32 -2, ptr %5, align 4
  store i32 1, ptr %14, align 4
  br label %67

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

22:                                               ; preds = %18
  store i32 -2, ptr %5, align 4
  store i32 1, ptr %14, align 4
  br label %67

23:                                               ; preds = %18
  %24 = load ptr, ptr %7, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.ma_data_source_node_config, ptr %24, i32 0, i32 1
  %26 = load ptr, ptr %25, align 8, !tbaa !9
  %27 = call i32 @ma_data_source_get_data_format(ptr noundef %26, ptr noundef %11, ptr noundef %12, ptr noundef null, ptr noundef null, i64 noundef 0)
  store i32 %27, ptr %10, align 4, !tbaa !14
  %28 = load i32, ptr %10, align 4, !tbaa !14
  %29 = icmp ne i32 %28, 0
  br i1 %29, label %30, label %32

30:                                               ; preds = %23
  %31 = load i32, ptr %10, align 4, !tbaa !14
  store i32 %31, ptr %5, align 4
  store i32 1, ptr %14, align 4
  br label %67

32:                                               ; preds = %23
  %33 = load i32, ptr %11, align 4, !tbaa !16
  %34 = icmp eq i32 %33, 5
  br i1 %34, label %35, label %36

35:                                               ; preds = %32
  br label %38

36:                                               ; preds = %32
  call void @__assert_fail(ptr noundef @.str.160, ptr noundef @.str.6, i32 noundef 69924, ptr noundef @__PRETTY_FUNCTION__.ma_data_source_node_init) #6
  unreachable

37:                                               ; No predecessors!
  br label %38

38:                                               ; preds = %37, %35
  %39 = load i32, ptr %11, align 4, !tbaa !16
  %40 = icmp ne i32 %39, 5
  br i1 %40, label %41, label %42

41:                                               ; preds = %38
  store i32 -2, ptr %5, align 4
  store i32 1, ptr %14, align 4
  br label %67

42:                                               ; preds = %38
  %43 = load ptr, ptr %7, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.ma_data_source_node_config, ptr %43, i32 0, i32 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %13, ptr align 8 %44, i64 40, i1 false), !tbaa.struct !18
  %45 = getelementptr inbounds %struct.ma_node_config, ptr %13, i32 0, i32 0
  store ptr @_ZL28g_ma_data_source_node_vtable, ptr %45, align 8, !tbaa !21
  %46 = getelementptr inbounds %struct.ma_node_config, ptr %13, i32 0, i32 5
  %47 = load ptr, ptr %46, align 8, !tbaa !22
  %48 = icmp ne ptr %47, null
  br i1 %48, label %49, label %50

49:                                               ; preds = %42
  store i32 -2, ptr %5, align 4
  store i32 1, ptr %14, align 4
  br label %67

50:                                               ; preds = %42
  %51 = getelementptr inbounds %struct.ma_node_config, ptr %13, i32 0, i32 5
  store ptr %12, ptr %51, align 8, !tbaa !22
  %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 = getelementptr inbounds %struct.ma_data_source_node, ptr %54, i32 0, i32 0
  %56 = call i32 @ma_node_init(ptr noundef %52, ptr noundef %13, ptr noundef %53, ptr noundef %55)
  store i32 %56, ptr %10, align 4, !tbaa !14
  %57 = load i32, ptr %10, align 4, !tbaa !14
  %58 = icmp ne i32 %57, 0
  br i1 %58, label %59, label %61

59:                                               ; preds = %50
  %60 = load i32, ptr %10, align 4, !tbaa !14
  store i32 %60, ptr %5, align 4
  store i32 1, ptr %14, align 4
  br label %67

61:                                               ; preds = %50
  %62 = load ptr, ptr %7, align 8, !tbaa !5
  %63 = getelementptr inbounds %struct.ma_data_source_node_config, ptr %62, i32 0, i32 1
  %64 = load ptr, ptr %63, align 8, !tbaa !9
  %65 = load ptr, ptr %9, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct.ma_data_source_node, ptr %65, i32 0, i32 1
  store ptr %64, ptr %66, align 8, !tbaa !23
  store i32 0, ptr %5, align 4
  store i32 1, ptr %14, align 4
  br label %67

67:                                               ; preds = %61, %59, %49, %41, %30, %22, %17
  call void @llvm.lifetime.end.p0(i64 40, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  %68 = load i32, ptr %5, align 4
  ret i32 %68
}

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 = { noreturn 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 #4 = { 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 #5 = { nounwind }
attributes #6 = { noreturn 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, !6, i64 40}
!10 = !{!"_ZTS26ma_data_source_node_config", !11, i64 0, !6, 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 = !{!15, !15, i64 0}
!15 = !{!"_ZTS9ma_result", !7, i64 0}
!16 = !{!17, !17, i64 0}
!17 = !{!"_ZTS9ma_format", !7, i64 0}
!18 = !{i64 0, i64 8, !5, i64 8, i64 4, !19, i64 12, i64 4, !20, i64 16, i64 4, !20, i64 24, i64 8, !5, i64 32, i64 8, !5}
!19 = !{!12, !12, i64 0}
!20 = !{!13, !13, i64 0}
!21 = !{!11, !6, i64 0}
!22 = !{!11, !6, i64 32}
!23 = !{!24, !6, i64 360}
!24 = !{!"_ZTS19ma_data_source_node", !25, i64 0, !6, i64 360}
!25 = !{!"_ZTS12ma_node_base", !6, i64 0, !6, i64 8, !6, i64 16, !26, i64 24, !26, i64 26, !26, i64 28, !26, i64 30, !12, i64 32, !7, i64 40, !27, i64 56, !13, i64 64, !13, i64 68, !6, i64 72, !6, i64 80, !7, i64 88, !7, i64 232, !6, i64 344, !13, i64 352}
!26 = !{!"short", !7, i64 0}
!27 = !{!"long long", !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"

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

@.str.6 = external hidden unnamed_addr constant [104 x i8], align 1
@.str.160 = external hidden unnamed_addr constant [24 x i8], align 1
@__PRETTY_FUNCTION__.ma_data_source_node_init = external hidden unnamed_addr constant [144 x i8], align 1
@_ZL28g_ma_data_source_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 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: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #3

; Function Attrs: mustprogress uwtable
declare dso_local i32 @ma_data_source_get_data_format(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #4

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

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

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

11:                                               ; preds = %9
  %12 = getelementptr inbounds i8, ptr %1, i64 40
  %13 = load ptr, ptr %12, align 8, !tbaa !5
  %14 = call i32 @ma_data_source_get_data_format(ptr noundef %13, ptr noundef nonnull %5, ptr noundef nonnull %6, ptr noundef null, ptr noundef null, i64 noundef 0)
  %.not = icmp eq i32 %14, 0
  br i1 %.not, label %15, label %27

15:                                               ; preds = %11
  %16 = load i32, ptr %5, align 4, !tbaa !13
  %17 = icmp eq i32 %16, 5
  br i1 %17, label %19, label %18

18:                                               ; preds = %15
  call void @__assert_fail(ptr noundef nonnull @.str.160, ptr noundef nonnull @.str.6, i32 noundef 69924, ptr noundef nonnull @__PRETTY_FUNCTION__.ma_data_source_node_init) #6
  unreachable

19:                                               ; preds = %15
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(40) %7, ptr noundef nonnull align 8 dereferenceable(40) %1, i64 40, i1 false), !tbaa.struct !15
  store ptr @_ZL28g_ma_data_source_node_vtable, ptr %7, align 8, !tbaa !19
  %20 = getelementptr inbounds i8, ptr %7, i64 32
  %21 = load ptr, ptr %20, align 8, !tbaa !20
  %.not18 = icmp eq ptr %21, null
  br i1 %.not18, label %22, label %27

22:                                               ; preds = %19
  store ptr %6, ptr %20, align 8, !tbaa !20
  %23 = call i32 @ma_node_init(ptr noundef %0, ptr noundef nonnull %7, ptr noundef %2, ptr noundef nonnull %3)
  %.not19 = icmp eq i32 %23, 0
  br i1 %.not19, label %24, label %27

24:                                               ; preds = %22
  %25 = load ptr, ptr %12, align 8, !tbaa !5
  %26 = getelementptr inbounds i8, ptr %3, i64 360
  store ptr %25, ptr %26, align 8, !tbaa !21
  br label %27

27:                                               ; preds = %22, %19, %11, %9, %4, %24
  %.0 = phi i32 [ 0, %24 ], [ -2, %4 ], [ -2, %9 ], [ %14, %11 ], [ -2, %19 ], [ %23, %22 ]
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %7) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #5
  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 nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { noreturn 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 #4 = { 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 #5 = { nounwind }
attributes #6 = { noreturn 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, !8, i64 40}
!6 = !{!"_ZTS26ma_data_source_node_config", !7, i64 0, !8, 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 = !{!14, !14, i64 0}
!14 = !{!"_ZTS9ma_format", !9, i64 0}
!15 = !{i64 0, i64 8, !16, i64 8, i64 4, !17, i64 12, i64 4, !18, i64 16, i64 4, !18, i64 24, i64 8, !16, i64 32, i64 8, !16}
!16 = !{!8, !8, i64 0}
!17 = !{!11, !11, i64 0}
!18 = !{!12, !12, i64 0}
!19 = !{!7, !8, i64 0}
!20 = !{!7, !8, i64 32}
!21 = !{!22, !8, i64 360}
!22 = !{!"_ZTS19ma_data_source_node", !23, i64 0, !8, i64 360}
!23 = !{!"_ZTS12ma_node_base", !8, i64 0, !8, i64 8, !8, i64 16, !24, i64 24, !24, i64 26, !24, i64 28, !24, i64 30, !11, i64 32, !9, i64 40, !25, i64 56, !12, i64 64, !12, i64 68, !8, i64 72, !8, i64 80, !9, i64 88, !9, i64 232, !8, i64 344, !12, i64 352}
!24 = !{!"short", !9, i64 0}
!25 = !{!"long long", !9, i64 0}


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