; 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_device_config = type { i32, i32, i32, i32, i32, i32, i8, i8, i8, i8, ptr, ptr, ptr, ptr, %struct.ma_resampler_config, %struct.anon.49, %struct.anon.50, %struct.anon.51, %struct.anon.52, %struct.anon.53, %struct.anon.54, %struct.anon.55, %struct.anon.56 }
%struct.ma_resampler_config = type { i32, i32, i32, i32, i32, ptr, ptr, %struct.anon.48 }
%struct.anon.48 = type { i32 }
%struct.anon.49 = type { ptr, i32, i32, ptr, i32, i32 }
%struct.anon.50 = type { ptr, i32, i32, ptr, i32, i32 }
%struct.anon.51 = type { i8, i8, i8, i8 }
%struct.anon.52 = type { i32, i32, i32, i32 }
%struct.anon.53 = type { ptr, ptr }
%struct.anon.54 = type { i32 }
%struct.anon.55 = type { i32, i32 }
%struct.anon.56 = type { i32, i32, i32, i32 }

; 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
define dso_local void @ma_device_config_init(ptr dead_on_unwind noalias writable sret(%struct.ma_device_config) align 8 %0, i32 noundef %1) #3 {
  %3 = alloca i32, align 4
  %4 = alloca %struct.ma_resampler_config, align 8
  store i32 %1, ptr %3, align 4, !tbaa !5
  call void @llvm.memset.p0.i64(ptr align 8 %0, i8 0, i64 248, i1 false)
  %5 = load i32, ptr %3, align 4, !tbaa !5
  %6 = getelementptr inbounds %struct.ma_device_config, ptr %0, i32 0, i32 0
  store i32 %5, ptr %6, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 48, ptr %4) #5
  call void @ma_resampler_config_init(ptr dead_on_unwind writable sret(%struct.ma_resampler_config) align 8 %4, i32 noundef 0, i32 noundef 0, i32 noundef 0, i32 noundef 0, i32 noundef 0)
  %7 = getelementptr inbounds %struct.ma_device_config, ptr %0, i32 0, i32 14
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %7, ptr align 8 %4, i64 48, i1 false), !tbaa.struct !33
  call void @llvm.lifetime.end.p0(i64 48, ptr %4) #5
  ret void
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @ma_resampler_config_init(ptr dead_on_unwind noalias writable sret(%struct.ma_resampler_config) align 8, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef) #4

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 = !{!"_ZTS14ma_device_type", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !6, i64 0}
!10 = !{!"_ZTS16ma_device_config", !6, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !11, i64 16, !12, i64 20, !7, i64 24, !7, i64 25, !7, i64 26, !7, i64 27, !13, i64 32, !13, i64 40, !13, i64 48, !13, i64 56, !14, i64 64, !18, i64 112, !21, i64 144, !22, i64 176, !23, i64 180, !24, i64 200, !25, i64 216, !26, i64 220, !29, i64 228}
!11 = !{!"int", !7, i64 0}
!12 = !{!"_ZTS22ma_performance_profile", !7, i64 0}
!13 = !{!"any pointer", !7, i64 0}
!14 = !{!"_ZTS19ma_resampler_config", !15, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !16, i64 16, !13, i64 24, !13, i64 32, !17, i64 40}
!15 = !{!"_ZTS9ma_format", !7, i64 0}
!16 = !{!"_ZTS21ma_resample_algorithm", !7, i64 0}
!17 = !{!"_ZTSN19ma_resampler_configUt_E", !11, i64 0}
!18 = !{!"_ZTSN16ma_device_configUt_E", !13, i64 0, !15, i64 8, !11, i64 12, !13, i64 16, !19, i64 24, !20, i64 28}
!19 = !{!"_ZTS19ma_channel_mix_mode", !7, i64 0}
!20 = !{!"_ZTS13ma_share_mode", !7, i64 0}
!21 = !{!"_ZTSN16ma_device_configUt0_E", !13, i64 0, !15, i64 8, !11, i64 12, !13, i64 16, !19, i64 24, !20, i64 28}
!22 = !{!"_ZTSN16ma_device_configUt1_E", !7, i64 0, !7, i64 1, !7, i64 2, !7, i64 3}
!23 = !{!"_ZTSN16ma_device_configUt2_E", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12}
!24 = !{!"_ZTSN16ma_device_configUt3_E", !13, i64 0, !13, i64 8}
!25 = !{!"_ZTSN16ma_device_configUt4_E", !11, i64 0}
!26 = !{!"_ZTSN16ma_device_configUt5_E", !27, i64 0, !28, i64 4}
!27 = !{!"_ZTS21ma_opensl_stream_type", !7, i64 0}
!28 = !{!"_ZTS26ma_opensl_recording_preset", !7, i64 0}
!29 = !{!"_ZTSN16ma_device_configUt6_E", !30, i64 0, !31, i64 4, !32, i64 8, !11, i64 12}
!30 = !{!"_ZTS15ma_aaudio_usage", !7, i64 0}
!31 = !{!"_ZTS22ma_aaudio_content_type", !7, i64 0}
!32 = !{!"_ZTS22ma_aaudio_input_preset", !7, i64 0}
!33 = !{i64 0, i64 4, !34, i64 4, i64 4, !35, i64 8, i64 4, !35, i64 12, i64 4, !35, i64 16, i64 4, !36, i64 24, i64 8, !37, i64 32, i64 8, !37, i64 40, i64 4, !35}
!34 = !{!15, !15, i64 0}
!35 = !{!11, !11, i64 0}
!36 = !{!16, !16, i64 0}
!37 = !{!13, !13, 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_device_config = type { i32, i32, i32, i32, i32, i32, i8, i8, i8, i8, ptr, ptr, ptr, ptr, %struct.ma_resampler_config, %struct.anon.49, %struct.anon.50, %struct.anon.51, %struct.anon.52, %struct.anon.53, %struct.anon.54, %struct.anon.55, %struct.anon.56 }
%struct.ma_resampler_config = type { i32, i32, i32, i32, i32, ptr, ptr, %struct.anon.48 }
%struct.anon.48 = type { i32 }
%struct.anon.49 = type { ptr, i32, i32, ptr, i32, i32 }
%struct.anon.50 = type { ptr, i32, i32, ptr, i32, i32 }
%struct.anon.51 = type { i8, i8, i8, i8 }
%struct.anon.52 = type { i32, i32, i32, i32 }
%struct.anon.53 = type { ptr, ptr }
%struct.anon.54 = type { i32 }
%struct.anon.55 = type { i32, i32 }
%struct.anon.56 = type { i32, i32, i32, i32 }

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

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @ma_device_config_init(ptr dead_on_unwind noalias nocapture writable writeonly sret(%struct.ma_device_config) align 8 %0, i32 noundef %1) local_unnamed_addr #1 {
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(248) %0, i8 0, i64 248, i1 false)
  store i32 %1, ptr %0, align 8, !tbaa !5
  %3 = getelementptr inbounds i8, ptr %0, i64 64
  tail call void @ma_resampler_config_init(ptr dead_on_unwind nonnull writable sret(%struct.ma_resampler_config) align 8 %3, i32 noundef 0, i32 noundef 0, i32 noundef 0, i32 noundef 0, i32 noundef 0)
  ret void
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @ma_resampler_config_init(ptr dead_on_unwind noalias writable sret(%struct.ma_resampler_config) align 8, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #1

attributes #0 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #1 = { 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" }

!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 = !{!"_ZTS16ma_device_config", !7, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !11, i64 20, !8, i64 24, !8, i64 25, !8, i64 26, !8, i64 27, !12, i64 32, !12, i64 40, !12, i64 48, !12, i64 56, !13, i64 64, !17, i64 112, !20, i64 144, !21, i64 176, !22, i64 180, !23, i64 200, !24, i64 216, !25, i64 220, !28, i64 228}
!7 = !{!"_ZTS14ma_device_type", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!"_ZTS22ma_performance_profile", !8, i64 0}
!12 = !{!"any pointer", !8, i64 0}
!13 = !{!"_ZTS19ma_resampler_config", !14, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !15, i64 16, !12, i64 24, !12, i64 32, !16, i64 40}
!14 = !{!"_ZTS9ma_format", !8, i64 0}
!15 = !{!"_ZTS21ma_resample_algorithm", !8, i64 0}
!16 = !{!"_ZTSN19ma_resampler_configUt_E", !10, i64 0}
!17 = !{!"_ZTSN16ma_device_configUt_E", !12, i64 0, !14, i64 8, !10, i64 12, !12, i64 16, !18, i64 24, !19, i64 28}
!18 = !{!"_ZTS19ma_channel_mix_mode", !8, i64 0}
!19 = !{!"_ZTS13ma_share_mode", !8, i64 0}
!20 = !{!"_ZTSN16ma_device_configUt0_E", !12, i64 0, !14, i64 8, !10, i64 12, !12, i64 16, !18, i64 24, !19, i64 28}
!21 = !{!"_ZTSN16ma_device_configUt1_E", !8, i64 0, !8, i64 1, !8, i64 2, !8, i64 3}
!22 = !{!"_ZTSN16ma_device_configUt2_E", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12}
!23 = !{!"_ZTSN16ma_device_configUt3_E", !12, i64 0, !12, i64 8}
!24 = !{!"_ZTSN16ma_device_configUt4_E", !10, i64 0}
!25 = !{!"_ZTSN16ma_device_configUt5_E", !26, i64 0, !27, i64 4}
!26 = !{!"_ZTS21ma_opensl_stream_type", !8, i64 0}
!27 = !{!"_ZTS26ma_opensl_recording_preset", !8, i64 0}
!28 = !{!"_ZTSN16ma_device_configUt6_E", !29, i64 0, !30, i64 4, !31, i64 8, !10, i64 12}
!29 = !{!"_ZTS15ma_aaudio_usage", !8, i64 0}
!30 = !{!"_ZTS22ma_aaudio_content_type", !8, i64 0}
!31 = !{!"_ZTS22ma_aaudio_input_preset", !8, i64 0}


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