; 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_flac = type { %struct.ma_data_source_base, ptr, ptr, ptr, ptr, i32, ptr }
%struct.ma_data_source_base = type { ptr, i64, i64, i64, i64, ptr, ptr, ptr, i32 }
%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__memory_stream = type { ptr, i64, i64 }
%struct.drflac_bs = type { ptr, ptr, ptr, i64, i64, i32, i32, [512 x i64], i64, i16, i64, i32 }

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_Z23ma_flac_get_data_formatP7ma_flacP9ma_formatPjS3_Phm(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4, i64 noundef %5) #1 {
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca i64, align 8
  store ptr %0, ptr %8, align 8, !tbaa !5
  store ptr %1, ptr %9, align 8, !tbaa !5
  store ptr %2, ptr %10, align 8, !tbaa !5
  store ptr %3, ptr %11, align 8, !tbaa !5
  store ptr %4, ptr %12, align 8, !tbaa !5
  store i64 %5, ptr %13, align 8, !tbaa !9
  %14 = load ptr, ptr %9, align 8, !tbaa !5
  %15 = icmp ne ptr %14, null
  br i1 %15, label %16, label %18

16:                                               ; preds = %6
  %17 = load ptr, ptr %9, align 8, !tbaa !5
  store i32 0, ptr %17, align 4, !tbaa !11
  br label %18

18:                                               ; preds = %16, %6
  %19 = load ptr, ptr %10, align 8, !tbaa !5
  %20 = icmp ne ptr %19, null
  br i1 %20, label %21, label %23

21:                                               ; preds = %18
  %22 = load ptr, ptr %10, align 8, !tbaa !5
  store i32 0, ptr %22, align 4, !tbaa !13
  br label %23

23:                                               ; preds = %21, %18
  %24 = load ptr, ptr %11, align 8, !tbaa !5
  %25 = icmp ne ptr %24, null
  br i1 %25, label %26, label %28

26:                                               ; preds = %23
  %27 = load ptr, ptr %11, align 8, !tbaa !5
  store i32 0, ptr %27, align 4, !tbaa !13
  br label %28

28:                                               ; preds = %26, %23
  %29 = load ptr, ptr %12, align 8, !tbaa !5
  %30 = icmp ne ptr %29, null
  br i1 %30, label %31, label %35

31:                                               ; preds = %28
  %32 = load ptr, ptr %12, align 8, !tbaa !5
  %33 = load i64, ptr %13, align 8, !tbaa !9
  %34 = mul i64 1, %33
  call void @llvm.memset.p0.i64(ptr align 1 %32, i8 0, i64 %34, i1 false)
  br label %35

35:                                               ; preds = %31, %28
  %36 = load ptr, ptr %8, align 8, !tbaa !5
  %37 = icmp eq ptr %36, null
  br i1 %37, label %38, label %39

38:                                               ; preds = %35
  store i32 -3, ptr %7, align 4
  br label %81

39:                                               ; preds = %35
  %40 = load ptr, ptr %9, align 8, !tbaa !5
  %41 = icmp ne ptr %40, null
  br i1 %41, label %42, label %47

42:                                               ; preds = %39
  %43 = load ptr, ptr %8, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.ma_flac, ptr %43, i32 0, i32 5
  %45 = load i32, ptr %44, align 8, !tbaa !15
  %46 = load ptr, ptr %9, align 8, !tbaa !5
  store i32 %45, ptr %46, align 4, !tbaa !11
  br label %47

47:                                               ; preds = %42, %39
  %48 = load ptr, ptr %10, align 8, !tbaa !5
  %49 = icmp ne ptr %48, null
  br i1 %49, label %50, label %58

50:                                               ; preds = %47
  %51 = load ptr, ptr %8, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.ma_flac, ptr %51, i32 0, i32 6
  %53 = load ptr, ptr %52, align 8, !tbaa !19
  %54 = getelementptr inbounds %struct.drflac, ptr %53, i32 0, i32 4
  %55 = load i8, ptr %54, align 4, !tbaa !20
  %56 = zext i8 %55 to i32
  %57 = load ptr, ptr %10, align 8, !tbaa !5
  store i32 %56, ptr %57, align 4, !tbaa !13
  br label %58

58:                                               ; preds = %50, %47
  %59 = load ptr, ptr %11, align 8, !tbaa !5
  %60 = icmp ne ptr %59, null
  br i1 %60, label %61, label %68

61:                                               ; preds = %58
  %62 = load ptr, ptr %8, align 8, !tbaa !5
  %63 = getelementptr inbounds %struct.ma_flac, ptr %62, i32 0, i32 6
  %64 = load ptr, ptr %63, align 8, !tbaa !19
  %65 = getelementptr inbounds %struct.drflac, ptr %64, i32 0, i32 3
  %66 = load i32, ptr %65, align 8, !tbaa !29
  %67 = load ptr, ptr %11, align 8, !tbaa !5
  store i32 %66, ptr %67, align 4, !tbaa !13
  br label %68

68:                                               ; preds = %61, %58
  %69 = load ptr, ptr %12, align 8, !tbaa !5
  %70 = icmp ne ptr %69, null
  br i1 %70, label %71, label %80

71:                                               ; preds = %68
  %72 = load ptr, ptr %12, align 8, !tbaa !5
  %73 = load i64, ptr %13, align 8, !tbaa !9
  %74 = load ptr, ptr %8, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct.ma_flac, ptr %74, i32 0, i32 6
  %76 = load ptr, ptr %75, align 8, !tbaa !19
  %77 = getelementptr inbounds %struct.drflac, ptr %76, i32 0, i32 4
  %78 = load i8, ptr %77, align 4, !tbaa !20
  %79 = zext i8 %78 to i32
  call void @ma_channel_map_init_standard(i32 noundef 0, ptr noundef %72, i64 noundef %73, i32 noundef %79)
  br label %80

80:                                               ; preds = %71, %68
  store i32 0, ptr %7, align 4
  br label %81

81:                                               ; preds = %80, %38
  %82 = load i32, ptr %7, align 4
  ret i32 %82
}

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

!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, !12, i64 0}
!12 = !{!"_ZTS9ma_format", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"int", !7, i64 0}
!15 = !{!16, !12, i64 104}
!16 = !{!"_ZTS7ma_flac", !17, i64 0, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !12, i64 104, !6, i64 112}
!17 = !{!"_ZTS19ma_data_source_base", !6, i64 0, !18, i64 8, !18, i64 16, !18, i64 24, !18, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !14, i64 64}
!18 = !{!"long long", !7, i64 0}
!19 = !{!16, !6, i64 112}
!20 = !{!21, !7, i64 52}
!21 = !{!"_ZTS6drflac", !6, i64 0, !6, i64 8, !22, i64 16, !14, i64 48, !7, i64 52, !7, i64 53, !23, i64 54, !18, i64 56, !24, i64 64, !14, i64 68, !25, i64 72, !18, i64 232, !18, i64 240, !27, i64 248, !6, i64 272, !6, i64 280, !6, i64 288, !14, i64 296, !14, i64 296, !14, i64 296, !28, i64 304, !7, i64 4480}
!22 = !{!"_ZTS27drflac_allocation_callbacks", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!23 = !{!"short", !7, i64 0}
!24 = !{!"_ZTS16drflac_container", !7, i64 0}
!25 = !{!"_ZTS12drflac_frame", !26, i64 0, !14, i64 24, !7, i64 32}
!26 = !{!"_ZTS19drflac_frame_header", !18, i64 0, !14, i64 8, !14, i64 12, !23, i64 16, !7, i64 18, !7, i64 19, !7, i64 20}
!27 = !{!"_ZTS21drflac__memory_stream", !6, i64 0, !10, i64 8, !10, i64 16}
!28 = !{!"_ZTS9drflac_bs", !6, i64 0, !6, i64 8, !6, i64 16, !10, i64 24, !18, i64 32, !14, i64 40, !14, i64 44, !7, i64 48, !18, i64 4144, !23, i64 4152, !18, i64 4160, !14, i64 4168}
!29 = !{!21, !14, i64 48}


; 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 nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #0

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

; Function Attrs: mustprogress uwtable
define dso_local noundef range(i32 -3, 1) i32 @_Z23ma_flac_get_data_formatP7ma_flacP9ma_formatPjS3_Phm(ptr noundef readonly %0, ptr noundef writeonly %1, ptr noundef writeonly %2, ptr noundef writeonly %3, ptr noundef %4, i64 noundef %5) local_unnamed_addr #1 {
  %.not = icmp eq ptr %1, null
  br i1 %.not, label %8, label %7

7:                                                ; preds = %6
  store i32 0, ptr %1, align 4, !tbaa !5
  br label %8

8:                                                ; preds = %7, %6
  %.not31 = icmp eq ptr %2, null
  br i1 %.not31, label %10, label %9

9:                                                ; preds = %8
  store i32 0, ptr %2, align 4, !tbaa !9
  br label %10

10:                                               ; preds = %9, %8
  %.not32 = icmp eq ptr %3, null
  br i1 %.not32, label %12, label %11

11:                                               ; preds = %10
  store i32 0, ptr %3, align 4, !tbaa !9
  br label %12

12:                                               ; preds = %11, %10
  %.not33 = icmp eq ptr %4, null
  br i1 %.not33, label %14, label %13

13:                                               ; preds = %12
  tail call void @llvm.memset.p0.i64(ptr nonnull align 1 %4, i8 0, i64 %5, i1 false)
  br label %14

14:                                               ; preds = %13, %12
  %15 = icmp eq ptr %0, null
  br i1 %15, label %40, label %16

16:                                               ; preds = %14
  br i1 %.not, label %20, label %17

17:                                               ; preds = %16
  %18 = getelementptr inbounds i8, ptr %0, i64 104
  %19 = load i32, ptr %18, align 8, !tbaa !11
  store i32 %19, ptr %1, align 4, !tbaa !5
  br label %20

20:                                               ; preds = %17, %16
  br i1 %.not31, label %27, label %21

21:                                               ; preds = %20
  %22 = getelementptr inbounds i8, ptr %0, i64 112
  %23 = load ptr, ptr %22, align 8, !tbaa !16
  %24 = getelementptr inbounds i8, ptr %23, i64 52
  %25 = load i8, ptr %24, align 4, !tbaa !17
  %26 = zext i8 %25 to i32
  store i32 %26, ptr %2, align 4, !tbaa !9
  br label %27

27:                                               ; preds = %21, %20
  br i1 %.not32, label %33, label %28

28:                                               ; preds = %27
  %29 = getelementptr inbounds i8, ptr %0, i64 112
  %30 = load ptr, ptr %29, align 8, !tbaa !16
  %31 = getelementptr inbounds i8, ptr %30, i64 48
  %32 = load i32, ptr %31, align 8, !tbaa !27
  store i32 %32, ptr %3, align 4, !tbaa !9
  br label %33

33:                                               ; preds = %28, %27
  br i1 %.not33, label %40, label %34

34:                                               ; preds = %33
  %35 = getelementptr inbounds i8, ptr %0, i64 112
  %36 = load ptr, ptr %35, align 8, !tbaa !16
  %37 = getelementptr inbounds i8, ptr %36, i64 52
  %38 = load i8, ptr %37, align 4, !tbaa !17
  %39 = zext i8 %38 to i32
  tail call void @ma_channel_map_init_standard(i32 noundef 0, ptr noundef nonnull %4, i64 noundef %5, i32 noundef %39)
  br label %40

40:                                               ; preds = %33, %34, %14
  %.0 = phi i32 [ -3, %14 ], [ 0, %34 ], [ 0, %33 ]
  ret i32 %.0
}

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

!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 = !{!"_ZTS9ma_format", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !6, i64 104}
!12 = !{!"_ZTS7ma_flac", !13, i64 0, !14, i64 72, !14, i64 80, !14, i64 88, !14, i64 96, !6, i64 104, !14, i64 112}
!13 = !{!"_ZTS19ma_data_source_base", !14, i64 0, !15, i64 8, !15, i64 16, !15, i64 24, !15, i64 32, !14, i64 40, !14, i64 48, !14, i64 56, !10, i64 64}
!14 = !{!"any pointer", !7, i64 0}
!15 = !{!"long long", !7, i64 0}
!16 = !{!12, !14, i64 112}
!17 = !{!18, !7, i64 52}
!18 = !{!"_ZTS6drflac", !14, i64 0, !14, i64 8, !19, i64 16, !10, i64 48, !7, i64 52, !7, i64 53, !20, i64 54, !15, i64 56, !21, i64 64, !10, i64 68, !22, i64 72, !15, i64 232, !15, i64 240, !24, i64 248, !14, i64 272, !14, i64 280, !14, i64 288, !10, i64 296, !10, i64 296, !10, i64 296, !26, i64 304, !7, i64 4480}
!19 = !{!"_ZTS27drflac_allocation_callbacks", !14, i64 0, !14, i64 8, !14, i64 16, !14, i64 24}
!20 = !{!"short", !7, i64 0}
!21 = !{!"_ZTS16drflac_container", !7, i64 0}
!22 = !{!"_ZTS12drflac_frame", !23, i64 0, !10, i64 24, !7, i64 32}
!23 = !{!"_ZTS19drflac_frame_header", !15, i64 0, !10, i64 8, !10, i64 12, !20, i64 16, !7, i64 18, !7, i64 19, !7, i64 20}
!24 = !{!"_ZTS21drflac__memory_stream", !14, i64 0, !25, i64 8, !25, i64 16}
!25 = !{!"long", !7, i64 0}
!26 = !{!"_ZTS9drflac_bs", !14, i64 0, !14, i64 8, !14, i64 16, !25, i64 24, !15, i64 32, !10, i64 40, !10, i64 44, !7, i64 48, !15, i64 4144, !20, i64 4152, !15, i64 4160, !10, i64 4168}
!27 = !{!18, !10, i64 48}


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