; 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.drflac__memory_stream = type { ptr, i64, i64 }
%struct.drflac = type { ptr, ptr, %struct.drflac_allocation_callbacks, i32, i8, i8, i16, i64, i32, i32, %struct.drflac_frame, i64, i64, %struct.drflac__memory_stream, ptr, ptr, ptr, i8, %struct.drflac_bs, [1 x i8] }
%struct.drflac_allocation_callbacks = type { ptr, ptr, ptr, ptr }
%struct.drflac_frame = type { %struct.drflac_frame_header, i32, [8 x %struct.drflac_subframe] }
%struct.drflac_frame_header = type { i64, i32, i32, i16, i8, i8, i8 }
%struct.drflac_subframe = type { i8, i8, i8, ptr }
%struct.drflac_bs = type { ptr, ptr, ptr, i64, i64, i32, i32, [512 x i64], i64, i16, i64, i32 }
%struct.drflac_oggbs = type { ptr, ptr, ptr, i64, i64, i32, %struct.drflac_ogg_page_header, %struct.drflac_ogg_page_header, i32, i32, [65307 x i8] }
%struct.drflac_ogg_page_header = type { [4 x i8], i8, i8, i64, i32, i32, i32, i8, [255 x i8] }

; 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: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #1

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

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef i64 @_ZL22drflac__on_read_memoryPvS_m(ptr noundef, ptr noundef, i64 noundef) #3

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

; Function Attrs: mustprogress uwtable
define dso_local ptr @drflac_open_memory_with_metadata(ptr noundef %0, i64 noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4) #2 {
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i64, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca %struct.drflac__memory_stream, align 8
  %13 = alloca ptr, align 8
  %14 = alloca i32, align 4
  %15 = alloca ptr, align 8
  store ptr %0, ptr %7, align 8, !tbaa !5
  store i64 %1, ptr %8, align 8, !tbaa !9
  store ptr %2, ptr %9, align 8, !tbaa !5
  store ptr %3, ptr %10, align 8, !tbaa !5
  store ptr %4, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 24, ptr %12) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #4
  %16 = load ptr, ptr %7, align 8, !tbaa !5
  %17 = getelementptr inbounds %struct.drflac__memory_stream, ptr %12, i32 0, i32 0
  store ptr %16, ptr %17, align 8, !tbaa !11
  %18 = load i64, ptr %8, align 8, !tbaa !9
  %19 = getelementptr inbounds %struct.drflac__memory_stream, ptr %12, i32 0, i32 1
  store i64 %18, ptr %19, align 8, !tbaa !13
  %20 = getelementptr inbounds %struct.drflac__memory_stream, ptr %12, i32 0, i32 2
  store i64 0, ptr %20, align 8, !tbaa !14
  %21 = load ptr, ptr %9, align 8, !tbaa !5
  %22 = load ptr, ptr %10, align 8, !tbaa !5
  %23 = load ptr, ptr %11, align 8, !tbaa !5
  %24 = call noundef ptr @_ZL33drflac_open_with_metadata_privatePFmPvS_mEPFjS_i18drflac_seek_originEPFvS_P15drflac_metadataE16drflac_containerS_S_PK27drflac_allocation_callbacks(ptr noundef @_ZL22drflac__on_read_memoryPvS_m, ptr noundef @_ZL22drflac__on_seek_memoryPvi18drflac_seek_origin, ptr noundef %21, i32 noundef 2, ptr noundef %12, ptr noundef %22, ptr noundef %23)
  store ptr %24, ptr %13, align 8, !tbaa !5
  %25 = load ptr, ptr %13, align 8, !tbaa !5
  %26 = icmp eq ptr %25, null
  br i1 %26, label %27, label %28

27:                                               ; preds = %5
  store ptr null, ptr %6, align 8
  store i32 1, ptr %14, align 4
  br label %51

28:                                               ; preds = %5
  %29 = load ptr, ptr %13, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.drflac, ptr %29, i32 0, i32 13
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %30, ptr align 8 %12, i64 24, i1 false), !tbaa.struct !15
  %31 = load ptr, ptr %13, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.drflac, ptr %31, i32 0, i32 8
  %33 = load i32, ptr %32, align 8, !tbaa !16
  %34 = icmp eq i32 %33, 1
  br i1 %34, label %35, label %43

35:                                               ; preds = %28
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #4
  %36 = load ptr, ptr %13, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.drflac, ptr %36, i32 0, i32 16
  %38 = load ptr, ptr %37, align 8, !tbaa !26
  store ptr %38, ptr %15, align 8, !tbaa !5
  %39 = load ptr, ptr %13, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct.drflac, ptr %39, i32 0, i32 13
  %41 = load ptr, ptr %15, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.drflac_oggbs, ptr %41, i32 0, i32 2
  store ptr %40, ptr %42, align 8, !tbaa !27
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #4
  br label %49

43:                                               ; preds = %28
  %44 = load ptr, ptr %13, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct.drflac, ptr %44, i32 0, i32 13
  %46 = load ptr, ptr %13, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.drflac, ptr %46, i32 0, i32 18
  %48 = getelementptr inbounds %struct.drflac_bs, ptr %47, i32 0, i32 2
  store ptr %45, ptr %48, align 8, !tbaa !30
  br label %49

49:                                               ; preds = %43, %35
  %50 = load ptr, ptr %13, align 8, !tbaa !5
  store ptr %50, ptr %6, align 8
  store i32 1, ptr %14, align 4
  br label %51

51:                                               ; preds = %49, %27
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 24, ptr %12) #4
  %52 = load ptr, ptr %6, align 8
  ret ptr %52
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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, !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 = !{!"long", !7, i64 0}
!11 = !{!12, !6, i64 0}
!12 = !{!"_ZTS21drflac__memory_stream", !6, i64 0, !10, i64 8, !10, i64 16}
!13 = !{!12, !10, i64 8}
!14 = !{!12, !10, i64 16}
!15 = !{i64 0, i64 8, !5, i64 8, i64 8, !9, i64 16, i64 8, !9}
!16 = !{!17, !22, i64 64}
!17 = !{!"_ZTS6drflac", !6, i64 0, !6, i64 8, !18, i64 16, !19, i64 48, !7, i64 52, !7, i64 53, !20, i64 54, !21, i64 56, !22, i64 64, !19, i64 68, !23, i64 72, !21, i64 232, !21, i64 240, !12, i64 248, !6, i64 272, !6, i64 280, !6, i64 288, !19, i64 296, !19, i64 296, !19, i64 296, !25, i64 304, !7, i64 4480}
!18 = !{!"_ZTS27drflac_allocation_callbacks", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!19 = !{!"int", !7, i64 0}
!20 = !{!"short", !7, i64 0}
!21 = !{!"long long", !7, i64 0}
!22 = !{!"_ZTS16drflac_container", !7, i64 0}
!23 = !{!"_ZTS12drflac_frame", !24, i64 0, !19, i64 24, !7, i64 32}
!24 = !{!"_ZTS19drflac_frame_header", !21, i64 0, !19, i64 8, !19, i64 12, !20, i64 16, !7, i64 18, !7, i64 19, !7, i64 20}
!25 = !{!"_ZTS9drflac_bs", !6, i64 0, !6, i64 8, !6, i64 16, !10, i64 24, !21, i64 32, !19, i64 40, !19, i64 44, !7, i64 48, !21, i64 4144, !20, i64 4152, !21, i64 4160, !19, i64 4168}
!26 = !{!17, !6, i64 288}
!27 = !{!28, !6, i64 16}
!28 = !{!"_ZTS12drflac_oggbs", !6, i64 0, !6, i64 8, !6, i64 16, !21, i64 24, !21, i64 32, !19, i64 40, !29, i64 48, !29, i64 336, !19, i64 624, !19, i64 628, !7, i64 632}
!29 = !{!"_ZTS22drflac_ogg_page_header", !7, i64 0, !7, i64 4, !7, i64 5, !21, i64 8, !19, i64 16, !19, i64 20, !19, i64 24, !7, i64 28, !7, i64 29}
!30 = !{!17, !6, i64 320}


; 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.drflac__memory_stream = type { ptr, i64, i64 }

; 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: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #1

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

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef i64 @_ZL22drflac__on_read_memoryPvS_m(ptr noundef, ptr noundef, i64 noundef) #3

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

; Function Attrs: mustprogress uwtable
define dso_local noundef ptr @drflac_open_memory_with_metadata(ptr noundef %0, i64 noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4) local_unnamed_addr #2 {
  %6 = alloca %struct.drflac__memory_stream, align 8
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %6) #4
  store ptr %0, ptr %6, align 8, !tbaa !5
  %7 = getelementptr inbounds i8, ptr %6, i64 8
  store i64 %1, ptr %7, align 8, !tbaa !11
  %8 = getelementptr inbounds i8, ptr %6, i64 16
  store i64 0, ptr %8, align 8, !tbaa !12
  %9 = call noundef ptr @_ZL33drflac_open_with_metadata_privatePFmPvS_mEPFjS_i18drflac_seek_originEPFvS_P15drflac_metadataE16drflac_containerS_S_PK27drflac_allocation_callbacks(ptr noundef nonnull @_ZL22drflac__on_read_memoryPvS_m, ptr noundef nonnull @_ZL22drflac__on_seek_memoryPvi18drflac_seek_origin, ptr noundef %2, i32 noundef 2, ptr noundef nonnull %6, ptr noundef %3, ptr noundef %4)
  %10 = icmp eq ptr %9, null
  br i1 %10, label %22, label %11

11:                                               ; preds = %5
  %12 = getelementptr inbounds i8, ptr %9, i64 248
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %12, ptr noundef nonnull align 8 dereferenceable(24) %6, i64 24, i1 false), !tbaa.struct !13
  %13 = getelementptr inbounds i8, ptr %9, i64 64
  %14 = load i32, ptr %13, align 8, !tbaa !16
  %15 = icmp eq i32 %14, 1
  br i1 %15, label %16, label %20

16:                                               ; preds = %11
  %17 = getelementptr inbounds i8, ptr %9, i64 288
  %18 = load ptr, ptr %17, align 8, !tbaa !26
  %19 = getelementptr inbounds i8, ptr %18, i64 16
  br label %.sink.split

20:                                               ; preds = %11
  %21 = getelementptr inbounds i8, ptr %9, i64 320
  br label %.sink.split

.sink.split:                                      ; preds = %20, %16
  %.sink = phi ptr [ %19, %16 ], [ %21, %20 ]
  store ptr %12, ptr %.sink, align 8, !tbaa !14
  br label %22

22:                                               ; preds = %.sink.split, %5
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %6) #4
  ret ptr %9
}

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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, !7, i64 0}
!6 = !{!"_ZTS21drflac__memory_stream", !7, i64 0, !10, i64 8, !10, i64 16}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"long", !8, i64 0}
!11 = !{!6, !10, i64 8}
!12 = !{!6, !10, i64 16}
!13 = !{i64 0, i64 8, !14, i64 8, i64 8, !15, i64 16, i64 8, !15}
!14 = !{!7, !7, i64 0}
!15 = !{!10, !10, i64 0}
!16 = !{!17, !22, i64 64}
!17 = !{!"_ZTS6drflac", !7, i64 0, !7, i64 8, !18, i64 16, !19, i64 48, !8, i64 52, !8, i64 53, !20, i64 54, !21, i64 56, !22, i64 64, !19, i64 68, !23, i64 72, !21, i64 232, !21, i64 240, !6, i64 248, !7, i64 272, !7, i64 280, !7, i64 288, !19, i64 296, !19, i64 296, !19, i64 296, !25, i64 304, !8, i64 4480}
!18 = !{!"_ZTS27drflac_allocation_callbacks", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24}
!19 = !{!"int", !8, i64 0}
!20 = !{!"short", !8, i64 0}
!21 = !{!"long long", !8, i64 0}
!22 = !{!"_ZTS16drflac_container", !8, i64 0}
!23 = !{!"_ZTS12drflac_frame", !24, i64 0, !19, i64 24, !8, i64 32}
!24 = !{!"_ZTS19drflac_frame_header", !21, i64 0, !19, i64 8, !19, i64 12, !20, i64 16, !8, i64 18, !8, i64 19, !8, i64 20}
!25 = !{!"_ZTS9drflac_bs", !7, i64 0, !7, i64 8, !7, i64 16, !10, i64 24, !21, i64 32, !19, i64 40, !19, i64 44, !8, i64 48, !21, i64 4144, !20, i64 4152, !21, i64 4160, !19, i64 4168}
!26 = !{!17, !7, i64 288}


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