; 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.drmp3_allocation_callbacks = type { ptr, ptr, ptr, ptr }
%struct.ma_mp3 = type { %struct.ma_data_source_base, ptr, ptr, ptr, ptr, i32, %struct.drmp3, i32, ptr }
%struct.ma_data_source_base = type { ptr, i64, i64, i64, i64, ptr, ptr, ptr, i32 }
%struct.drmp3 = type { %struct.drmp3dec, %struct.drmp3dec_frame_info, i32, i32, ptr, ptr, ptr, %struct.drmp3_allocation_callbacks, i32, i32, i32, i32, [9216 x i8], i64, i64, ptr, i32, i64, i64, i64, ptr, i8, %struct.anon.59 }
%struct.drmp3dec = type { [2 x [288 x float]], [960 x float], i32, i32, [4 x i8], [511 x i8] }
%struct.drmp3dec_frame_info = type { i32, i32, i32, i32, i32 }
%struct.anon.59 = type { ptr, i64, i64 }

; 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: mustprogress uwtable
define dso_local noundef i32 @_Z11ma_mp3_initPF9ma_resultPvS0_mPmEPFS_S0_x14ma_seek_originEPFS_S0_PxES0_PK26ma_decoding_backend_configPK23ma_allocation_callbacksP6ma_mp3(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4, ptr noundef %5, ptr noundef %6) #1 {
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca ptr, align 8
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca %struct.drmp3_allocation_callbacks, align 8
  %19 = alloca i32, align 4
  store ptr %0, ptr %9, align 8, !tbaa !5
  store ptr %1, ptr %10, align 8, !tbaa !5
  store ptr %2, ptr %11, align 8, !tbaa !5
  store ptr %3, ptr %12, align 8, !tbaa !5
  store ptr %4, ptr %13, align 8, !tbaa !5
  store ptr %5, ptr %14, align 8, !tbaa !5
  store ptr %6, ptr %15, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #3
  %20 = load ptr, ptr %13, align 8, !tbaa !5
  %21 = load ptr, ptr %15, align 8, !tbaa !5
  %22 = call noundef i32 @_ZL20ma_mp3_init_internalPK26ma_decoding_backend_configP6ma_mp3(ptr noundef %20, ptr noundef %21)
  store i32 %22, ptr %16, align 4, !tbaa !9
  %23 = load i32, ptr %16, align 4, !tbaa !9
  %24 = icmp ne i32 %23, 0
  br i1 %24, label %25, label %27

25:                                               ; preds = %7
  %26 = load i32, ptr %16, align 4, !tbaa !9
  store i32 %26, ptr %8, align 4
  store i32 1, ptr %17, align 4
  br label %61

27:                                               ; preds = %7
  %28 = load ptr, ptr %9, align 8, !tbaa !5
  %29 = icmp eq ptr %28, null
  br i1 %29, label %33, label %30

30:                                               ; preds = %27
  %31 = load ptr, ptr %10, align 8, !tbaa !5
  %32 = icmp eq ptr %31, null
  br i1 %32, label %33, label %34

33:                                               ; preds = %30, %27
  store i32 -2, ptr %8, align 4
  store i32 1, ptr %17, align 4
  br label %61

34:                                               ; preds = %30
  %35 = load ptr, ptr %9, align 8, !tbaa !5
  %36 = load ptr, ptr %15, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.ma_mp3, ptr %36, i32 0, i32 1
  store ptr %35, ptr %37, align 8, !tbaa !11
  %38 = load ptr, ptr %10, align 8, !tbaa !5
  %39 = load ptr, ptr %15, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct.ma_mp3, ptr %39, i32 0, i32 2
  store ptr %38, ptr %40, align 8, !tbaa !23
  %41 = load ptr, ptr %11, align 8, !tbaa !5
  %42 = load ptr, ptr %15, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.ma_mp3, ptr %42, i32 0, i32 3
  store ptr %41, ptr %43, align 8, !tbaa !24
  %44 = load ptr, ptr %12, align 8, !tbaa !5
  %45 = load ptr, ptr %15, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct.ma_mp3, ptr %45, i32 0, i32 4
  store ptr %44, ptr %46, align 8, !tbaa !25
  call void @llvm.lifetime.start.p0(i64 32, ptr %18) #3
  %47 = load ptr, ptr %14, align 8, !tbaa !5
  call void @_ZL41drmp3_allocation_callbacks_from_miniaudioPK23ma_allocation_callbacks(ptr dead_on_unwind writable sret(%struct.drmp3_allocation_callbacks) align 8 %18, ptr noundef %47)
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #3
  %48 = load ptr, ptr %15, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct.ma_mp3, ptr %48, i32 0, i32 6
  %50 = load ptr, ptr %15, align 8, !tbaa !5
  %51 = call i32 @drmp3_init(ptr noundef %49, ptr noundef @_ZL24ma_mp3_dr_callback__readPvS_m, ptr noundef @_ZL24ma_mp3_dr_callback__seekPvi17drmp3_seek_origin, ptr noundef %50, ptr noundef %18)
  store i32 %51, ptr %19, align 4, !tbaa !26
  %52 = load i32, ptr %19, align 4, !tbaa !26
  %53 = icmp ne i32 %52, 1
  br i1 %53, label %54, label %55

54:                                               ; preds = %34
  store i32 -10, ptr %8, align 4
  store i32 1, ptr %17, align 4
  br label %60

55:                                               ; preds = %34
  %56 = load ptr, ptr %15, align 8, !tbaa !5
  %57 = load ptr, ptr %13, align 8, !tbaa !5
  %58 = load ptr, ptr %14, align 8, !tbaa !5
  %59 = call noundef i32 @_ZL26ma_mp3_generate_seek_tableP6ma_mp3PK26ma_decoding_backend_configPK23ma_allocation_callbacks(ptr noundef %56, ptr noundef %57, ptr noundef %58)
  store i32 0, ptr %8, align 4
  store i32 1, ptr %17, align 4
  br label %60

60:                                               ; preds = %55, %54
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #3
  call void @llvm.lifetime.end.p0(i64 32, ptr %18) #3
  br label %61

61:                                               ; preds = %60, %33, %25
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #3
  %62 = load i32, ptr %8, align 4
  ret i32 %62
}

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef i32 @_ZL20ma_mp3_init_internalPK26ma_decoding_backend_configP6ma_mp3(ptr noundef, ptr noundef) #2

; Function Attrs: mustprogress nounwind uwtable
declare hidden void @_ZL41drmp3_allocation_callbacks_from_miniaudioPK23ma_allocation_callbacks(ptr dead_on_unwind noalias writable sret(%struct.drmp3_allocation_callbacks) align 8, ptr noundef) #2

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

; Function Attrs: mustprogress uwtable
declare hidden noundef i64 @_ZL24ma_mp3_dr_callback__readPvS_m(ptr noundef, ptr noundef, i64 noundef) #1

; Function Attrs: mustprogress uwtable
declare hidden noundef i32 @_ZL24ma_mp3_dr_callback__seekPvi17drmp3_seek_origin(ptr noundef, i32 noundef, i32 noundef) #1

; Function Attrs: mustprogress uwtable
declare hidden noundef i32 @_ZL26ma_mp3_generate_seek_tableP6ma_mp3PK26ma_decoding_backend_configPK23ma_allocation_callbacks(ptr noundef, ptr noundef, ptr noundef) #1

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 #3 = { 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, !10, i64 0}
!10 = !{!"_ZTS9ma_result", !7, i64 0}
!11 = !{!12, !6, i64 72}
!12 = !{!"_ZTS6ma_mp3", !13, i64 0, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !16, i64 104, !17, i64 112, !15, i64 16192, !6, i64 16200}
!13 = !{!"_ZTS19ma_data_source_base", !6, i64 0, !14, i64 8, !14, i64 16, !14, i64 24, !14, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !15, i64 64}
!14 = !{!"long long", !7, i64 0}
!15 = !{!"int", !7, i64 0}
!16 = !{!"_ZTS9ma_format", !7, i64 0}
!17 = !{!"_ZTS5drmp3", !18, i64 0, !19, i64 6668, !15, i64 6688, !15, i64 6692, !6, i64 6696, !6, i64 6704, !6, i64 6712, !20, i64 6720, !15, i64 6752, !15, i64 6756, !15, i64 6760, !15, i64 6764, !7, i64 6768, !14, i64 15984, !14, i64 15992, !6, i64 16000, !15, i64 16008, !21, i64 16016, !21, i64 16024, !21, i64 16032, !6, i64 16040, !15, i64 16048, !22, i64 16056}
!18 = !{!"_ZTS8drmp3dec", !7, i64 0, !7, i64 2304, !15, i64 6144, !15, i64 6148, !7, i64 6152, !7, i64 6156}
!19 = !{!"_ZTS19drmp3dec_frame_info", !15, i64 0, !15, i64 4, !15, i64 8, !15, i64 12, !15, i64 16}
!20 = !{!"_ZTS26drmp3_allocation_callbacks", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!21 = !{!"long", !7, i64 0}
!22 = !{!"_ZTSN5drmp3Ut_E", !6, i64 0, !21, i64 8, !21, i64 16}
!23 = !{!12, !6, i64 80}
!24 = !{!12, !6, i64 88}
!25 = !{!12, !6, i64 96}
!26 = !{!15, !15, 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.drmp3_allocation_callbacks = type { ptr, ptr, ptr, ptr }

; 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 uwtable
define dso_local noundef i32 @_Z11ma_mp3_initPF9ma_resultPvS0_mPmEPFS_S0_x14ma_seek_originEPFS_S0_PxES0_PK26ma_decoding_backend_configPK23ma_allocation_callbacksP6ma_mp3(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4, ptr noundef %5, ptr noundef %6) local_unnamed_addr #1 {
  %8 = alloca %struct.drmp3_allocation_callbacks, align 8
  %9 = tail call noundef i32 @_ZL20ma_mp3_init_internalPK26ma_decoding_backend_configP6ma_mp3(ptr noundef %4, ptr noundef %6)
  %.not = icmp eq i32 %9, 0
  br i1 %.not, label %10, label %23

10:                                               ; preds = %7
  %11 = icmp eq ptr %0, null
  %12 = icmp eq ptr %1, null
  %or.cond = or i1 %11, %12
  br i1 %or.cond, label %23, label %13

13:                                               ; preds = %10
  %14 = getelementptr inbounds i8, ptr %6, i64 72
  store ptr %0, ptr %14, align 8, !tbaa !5
  %15 = getelementptr inbounds i8, ptr %6, i64 80
  store ptr %1, ptr %15, align 8, !tbaa !20
  %16 = getelementptr inbounds i8, ptr %6, i64 88
  store ptr %2, ptr %16, align 8, !tbaa !21
  %17 = getelementptr inbounds i8, ptr %6, i64 96
  store ptr %3, ptr %17, align 8, !tbaa !22
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %8) #3
  call void @_ZL41drmp3_allocation_callbacks_from_miniaudioPK23ma_allocation_callbacks(ptr dead_on_unwind nonnull writable sret(%struct.drmp3_allocation_callbacks) align 8 %8, ptr noundef %5)
  %18 = getelementptr inbounds i8, ptr %6, i64 112
  %19 = call i32 @drmp3_init(ptr noundef nonnull %18, ptr noundef nonnull @_ZL24ma_mp3_dr_callback__readPvS_m, ptr noundef nonnull @_ZL24ma_mp3_dr_callback__seekPvi17drmp3_seek_origin, ptr noundef %6, ptr noundef nonnull %8)
  %.not25 = icmp eq i32 %19, 1
  br i1 %.not25, label %20, label %22

20:                                               ; preds = %13
  %21 = call noundef i32 @_ZL26ma_mp3_generate_seek_tableP6ma_mp3PK26ma_decoding_backend_configPK23ma_allocation_callbacks(ptr noundef nonnull %6, ptr noundef %4, ptr noundef %5)
  br label %22

22:                                               ; preds = %13, %20
  %.0 = phi i32 [ 0, %20 ], [ -10, %13 ]
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %8) #3
  br label %23

23:                                               ; preds = %10, %7, %22
  %.1 = phi i32 [ %.0, %22 ], [ %9, %7 ], [ -2, %10 ]
  ret i32 %.1
}

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef i32 @_ZL20ma_mp3_init_internalPK26ma_decoding_backend_configP6ma_mp3(ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nounwind uwtable
declare hidden void @_ZL41drmp3_allocation_callbacks_from_miniaudioPK23ma_allocation_callbacks(ptr dead_on_unwind noalias writable sret(%struct.drmp3_allocation_callbacks) align 8, ptr noundef) local_unnamed_addr #2

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

; Function Attrs: mustprogress uwtable
declare hidden noundef i64 @_ZL24ma_mp3_dr_callback__readPvS_m(ptr noundef, ptr noundef, i64 noundef) #1

; Function Attrs: mustprogress uwtable
declare hidden noundef i32 @_ZL24ma_mp3_dr_callback__seekPvi17drmp3_seek_origin(ptr noundef, i32 noundef, i32 noundef) #1

; Function Attrs: mustprogress uwtable
declare hidden noundef i32 @_ZL26ma_mp3_generate_seek_tableP6ma_mp3PK26ma_decoding_backend_configPK23ma_allocation_callbacks(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 #3 = { 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 72}
!6 = !{!"_ZTS6ma_mp3", !7, i64 0, !8, i64 72, !8, i64 80, !8, i64 88, !8, i64 96, !13, i64 104, !14, i64 112, !12, i64 16192, !8, i64 16200}
!7 = !{!"_ZTS19ma_data_source_base", !8, i64 0, !11, i64 8, !11, i64 16, !11, i64 24, !11, i64 32, !8, i64 40, !8, i64 48, !8, i64 56, !12, i64 64}
!8 = !{!"any pointer", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = !{!"long long", !9, i64 0}
!12 = !{!"int", !9, i64 0}
!13 = !{!"_ZTS9ma_format", !9, i64 0}
!14 = !{!"_ZTS5drmp3", !15, i64 0, !16, i64 6668, !12, i64 6688, !12, i64 6692, !8, i64 6696, !8, i64 6704, !8, i64 6712, !17, i64 6720, !12, i64 6752, !12, i64 6756, !12, i64 6760, !12, i64 6764, !9, i64 6768, !11, i64 15984, !11, i64 15992, !8, i64 16000, !12, i64 16008, !18, i64 16016, !18, i64 16024, !18, i64 16032, !8, i64 16040, !12, i64 16048, !19, i64 16056}
!15 = !{!"_ZTS8drmp3dec", !9, i64 0, !9, i64 2304, !12, i64 6144, !12, i64 6148, !9, i64 6152, !9, i64 6156}
!16 = !{!"_ZTS19drmp3dec_frame_info", !12, i64 0, !12, i64 4, !12, i64 8, !12, i64 12, !12, i64 16}
!17 = !{!"_ZTS26drmp3_allocation_callbacks", !8, i64 0, !8, i64 8, !8, i64 16, !8, i64 24}
!18 = !{!"long", !9, i64 0}
!19 = !{!"_ZTSN5drmp3Ut_E", !8, i64 0, !18, i64 8, !18, i64 16}
!20 = !{!6, !8, i64 80}
!21 = !{!6, !8, i64 88}
!22 = !{!6, !8, i64 96}


; Effective O3 passes: CorrelatedValuePropagationPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,SROAPass,SimplifyCFGPass,TailCallElimPass