; 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 = type { ptr, i32, i32, i32, ptr, ptr, ptr, ptr, %union.pthread_mutex_t, %struct.ma_event, %struct.ma_event, %struct.ma_event, i64, i32, i8, i8, i8, i8, i8, float, %struct.ma_duplex_rb, %struct.anon.24, %struct.anon.26, %struct.anon.31, %union.anon.32 }
%union.pthread_mutex_t = type { %struct.__pthread_mutex_s }
%struct.__pthread_mutex_s = type { i32, i32, i32, i32, i32, i16, i16, %struct.__pthread_internal_list }
%struct.__pthread_internal_list = type { ptr, ptr }
%struct.ma_event = type { i32, %union.pthread_mutex_t, %union.pthread_cond_t }
%union.pthread_cond_t = type { %struct.__pthread_cond_s }
%struct.__pthread_cond_s = type { %union.__atomic_wide_counter, %union.__atomic_wide_counter, [2 x i32], [2 x i32], i32, i32, [2 x i32] }
%union.__atomic_wide_counter = type { i64 }
%struct.ma_duplex_rb = type { %struct.ma_pcm_rb }
%struct.ma_pcm_rb = type { %struct.ma_rb, i32, i32 }
%struct.ma_rb = type { ptr, i32, i32, i32, i32, i32, i8, i8, %struct.ma_allocation_callbacks }
%struct.ma_allocation_callbacks = type { ptr, ptr, ptr, ptr }
%struct.anon.24 = type { i32, ptr, ptr, %struct.anon.25 }
%struct.anon.25 = type { i32 }
%struct.anon.26 = type { ptr, %union.ma_device_id, [256 x i8], i32, i32, i32, [254 x i8], i32, i32, i32, [254 x i8], i32, i32, i32, %struct.ma_data_converter, ptr, i32, i32, ptr, i64, i64, i64 }
%union.ma_device_id = type { %union.anon.17 }
%union.anon.17 = type { ptr, [248 x i8] }
%struct.ma_data_converter = type { i32, i32, i32, i32, i32, i32, i32, i32, %struct.ma_channel_converter, %struct.ma_resampler, i8, i8, i8, i8, i8, i8, ptr }
%struct.ma_channel_converter = type { i32, i32, i32, i32, i32, ptr, ptr, ptr, %union.anon.27, ptr, i32 }
%union.anon.27 = type { ptr }
%struct.ma_resampler = type { ptr, ptr, ptr, i32, i32, i32, i32, %union.anon.28, ptr, i32 }
%union.anon.28 = type { %struct.ma_linear_resampler }
%struct.ma_linear_resampler = type { %struct.ma_linear_resampler_config, i32, i32, i32, i32, %union.anon.29, %union.anon.30, %struct.ma_lpf, ptr, i32 }
%struct.ma_linear_resampler_config = type { i32, i32, i32, i32, i32, double }
%union.anon.29 = type { ptr }
%union.anon.30 = type { ptr }
%struct.ma_lpf = type { i32, i32, i32, i32, i32, ptr, ptr, ptr, i32 }
%struct.anon.31 = type { ptr, %union.ma_device_id, [256 x i8], i32, i32, i32, [254 x i8], i32, i32, i32, [254 x i8], i32, i32, i32, %struct.ma_data_converter, ptr, i32, i32 }
%union.anon.32 = type { %struct.anon.36 }
%struct.anon.36 = type { i64, %struct.ma_event, %struct.ma_event, %struct.ma_semaphore, i32, i32, %union.ma_timer, double, i32, i32, i64, i64, i32 }
%struct.ma_semaphore = type { i32, %union.pthread_mutex_t, %union.pthread_cond_t }
%union.ma_timer = type { i64 }

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

8:                                                ; preds = %2
  store i32 -2, ptr %3, align 4
  br label %19

9:                                                ; preds = %2
  %10 = load ptr, ptr %4, align 8, !tbaa !5
  %11 = icmp eq ptr %10, null
  br i1 %11, label %12, label %14

12:                                               ; preds = %9
  %13 = load ptr, ptr %5, align 8, !tbaa !5
  store float 0.000000e+00, ptr %13, align 4, !tbaa !9
  store i32 -2, ptr %3, align 4
  br label %19

14:                                               ; preds = %9
  %15 = load ptr, ptr %4, align 8, !tbaa !5
  %16 = getelementptr inbounds %struct.ma_device, ptr %15, i32 0, i32 19
  %17 = call noundef float @_ZL27c89atomic_load_explicit_f32PVKfi(ptr noundef %16, i32 noundef 5)
  %18 = load ptr, ptr %5, align 8, !tbaa !5
  store float %17, ptr %18, align 4, !tbaa !9
  store i32 0, ptr %3, align 4
  br label %19

19:                                               ; preds = %14, %12, %8
  %20 = load i32, ptr %3, align 4
  ret i32 %20
}

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare hidden noundef float @_ZL27c89atomic_load_explicit_f32PVKfi(ptr noundef, i32 noundef) #1

attributes #0 = { 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 #1 = { alwaysinline 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, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"float", !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"

; Function Attrs: mustprogress nounwind uwtable
define dso_local range(i32 -2, 1) i32 @ma_device_get_master_volume(ptr noundef %0, ptr noundef writeonly %1) local_unnamed_addr #0 {
  %3 = icmp eq ptr %1, null
  br i1 %3, label %9, label %4

4:                                                ; preds = %2
  %5 = icmp eq ptr %0, null
  br i1 %5, label %.sink.split, label %6

6:                                                ; preds = %4
  %7 = getelementptr inbounds i8, ptr %0, i64 404
  %8 = tail call noundef float @_ZL27c89atomic_load_explicit_f32PVKfi(ptr noundef nonnull %7, i32 noundef 5)
  br label %.sink.split

.sink.split:                                      ; preds = %4, %6
  %.sink = phi float [ %8, %6 ], [ 0.000000e+00, %4 ]
  %.0.ph = phi i32 [ 0, %6 ], [ -2, %4 ]
  store float %.sink, ptr %1, align 4, !tbaa !5
  br label %9

9:                                                ; preds = %.sink.split, %2
  %.0 = phi i32 [ -2, %2 ], [ %.0.ph, %.sink.split ]
  ret i32 %.0
}

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare hidden noundef float @_ZL27c89atomic_load_explicit_f32PVKfi(ptr noundef, i32 noundef) local_unnamed_addr #1

attributes #0 = { 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 #1 = { alwaysinline 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, !6, i64 0}
!6 = !{!"float", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}


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