; 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_cuesheet_track = type { i64, i8, [12 x i8], i8, i8, i8, ptr }
%struct.drflac_cuesheet_track_iterator = type { i32, ptr }

; 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
define dso_local i32 @drflac_next_cuesheet_track(ptr noundef %0, ptr noundef %1) #2 {
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca %struct.drflac_cuesheet_track, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i64, align 8
  %9 = alloca i64, align 8
  %10 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 32, ptr %6) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  %11 = load ptr, ptr %4, align 8, !tbaa !5
  %12 = icmp eq ptr %11, null
  br i1 %12, label %23, label %13

13:                                               ; preds = %2
  %14 = load ptr, ptr %4, align 8, !tbaa !5
  %15 = getelementptr inbounds %struct.drflac_cuesheet_track_iterator, ptr %14, i32 0, i32 0
  %16 = load i32, ptr %15, align 8, !tbaa !9
  %17 = icmp eq i32 %16, 0
  br i1 %17, label %23, label %18

18:                                               ; preds = %13
  %19 = load ptr, ptr %4, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct.drflac_cuesheet_track_iterator, ptr %19, i32 0, i32 1
  %21 = load ptr, ptr %20, align 8, !tbaa !12
  %22 = icmp eq ptr %21, null
  br i1 %22, label %23, label %24

23:                                               ; preds = %18, %13, %2
  store i32 0, ptr %3, align 4
  store i32 1, ptr %10, align 4
  br label %100

24:                                               ; preds = %18
  %25 = load ptr, ptr %4, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.drflac_cuesheet_track_iterator, ptr %25, i32 0, i32 1
  %27 = load ptr, ptr %26, align 8, !tbaa !12
  store ptr %27, ptr %7, align 8, !tbaa !5
  %28 = load ptr, ptr %7, align 8, !tbaa !5
  %29 = load i32, ptr %28, align 4, !tbaa !13
  %30 = call noundef i32 @_ZL18drflac__be2host_32j(i32 noundef %29)
  %31 = zext i32 %30 to i64
  store i64 %31, ptr %8, align 8, !tbaa !14
  %32 = load ptr, ptr %7, align 8, !tbaa !5
  %33 = getelementptr inbounds i8, ptr %32, i64 4
  store ptr %33, ptr %7, align 8, !tbaa !5
  %34 = load ptr, ptr %7, align 8, !tbaa !5
  %35 = load i32, ptr %34, align 4, !tbaa !13
  %36 = call noundef i32 @_ZL18drflac__be2host_32j(i32 noundef %35)
  %37 = zext i32 %36 to i64
  store i64 %37, ptr %9, align 8, !tbaa !14
  %38 = load ptr, ptr %7, align 8, !tbaa !5
  %39 = getelementptr inbounds i8, ptr %38, i64 4
  store ptr %39, ptr %7, align 8, !tbaa !5
  %40 = load i64, ptr %9, align 8, !tbaa !14
  %41 = load i64, ptr %8, align 8, !tbaa !14
  %42 = shl i64 %41, 32
  %43 = or i64 %40, %42
  %44 = getelementptr inbounds %struct.drflac_cuesheet_track, ptr %6, i32 0, i32 0
  store i64 %43, ptr %44, align 8, !tbaa !16
  %45 = load ptr, ptr %7, align 8, !tbaa !5
  %46 = getelementptr inbounds i8, ptr %45, i64 0
  %47 = load i8, ptr %46, align 1, !tbaa !18
  %48 = getelementptr inbounds %struct.drflac_cuesheet_track, ptr %6, i32 0, i32 1
  store i8 %47, ptr %48, align 8, !tbaa !19
  %49 = load ptr, ptr %7, align 8, !tbaa !5
  %50 = getelementptr inbounds i8, ptr %49, i64 1
  store ptr %50, ptr %7, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct.drflac_cuesheet_track, ptr %6, i32 0, i32 2
  %52 = getelementptr inbounds [12 x i8], ptr %51, i64 0, i64 0
  %53 = load ptr, ptr %7, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %52, ptr align 1 %53, i64 12, i1 false)
  %54 = load ptr, ptr %7, align 8, !tbaa !5
  %55 = getelementptr inbounds i8, ptr %54, i64 12
  store ptr %55, ptr %7, align 8, !tbaa !5
  %56 = load ptr, ptr %7, align 8, !tbaa !5
  %57 = getelementptr inbounds i8, ptr %56, i64 0
  %58 = load i8, ptr %57, align 1, !tbaa !18
  %59 = sext i8 %58 to i32
  %60 = and i32 %59, 128
  %61 = icmp ne i32 %60, 0
  %62 = zext i1 %61 to i8
  %63 = getelementptr inbounds %struct.drflac_cuesheet_track, ptr %6, i32 0, i32 3
  store i8 %62, ptr %63, align 1, !tbaa !20
  %64 = load ptr, ptr %7, align 8, !tbaa !5
  %65 = getelementptr inbounds i8, ptr %64, i64 0
  %66 = load i8, ptr %65, align 1, !tbaa !18
  %67 = sext i8 %66 to i32
  %68 = and i32 %67, 64
  %69 = icmp ne i32 %68, 0
  %70 = zext i1 %69 to i8
  %71 = getelementptr inbounds %struct.drflac_cuesheet_track, ptr %6, i32 0, i32 4
  store i8 %70, ptr %71, align 2, !tbaa !21
  %72 = load ptr, ptr %7, align 8, !tbaa !5
  %73 = getelementptr inbounds i8, ptr %72, i64 14
  store ptr %73, ptr %7, align 8, !tbaa !5
  %74 = load ptr, ptr %7, align 8, !tbaa !5
  %75 = getelementptr inbounds i8, ptr %74, i64 0
  %76 = load i8, ptr %75, align 1, !tbaa !18
  %77 = getelementptr inbounds %struct.drflac_cuesheet_track, ptr %6, i32 0, i32 5
  store i8 %76, ptr %77, align 1, !tbaa !22
  %78 = load ptr, ptr %7, align 8, !tbaa !5
  %79 = getelementptr inbounds i8, ptr %78, i64 1
  store ptr %79, ptr %7, align 8, !tbaa !5
  %80 = load ptr, ptr %7, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct.drflac_cuesheet_track, ptr %6, i32 0, i32 6
  store ptr %80, ptr %81, align 8, !tbaa !23
  %82 = getelementptr inbounds %struct.drflac_cuesheet_track, ptr %6, i32 0, i32 5
  %83 = load i8, ptr %82, align 1, !tbaa !22
  %84 = zext i8 %83 to i64
  %85 = mul i64 %84, 12
  %86 = load ptr, ptr %7, align 8, !tbaa !5
  %87 = getelementptr inbounds i8, ptr %86, i64 %85
  store ptr %87, ptr %7, align 8, !tbaa !5
  %88 = load ptr, ptr %7, align 8, !tbaa !5
  %89 = load ptr, ptr %4, align 8, !tbaa !5
  %90 = getelementptr inbounds %struct.drflac_cuesheet_track_iterator, ptr %89, i32 0, i32 1
  store ptr %88, ptr %90, align 8, !tbaa !12
  %91 = load ptr, ptr %4, align 8, !tbaa !5
  %92 = getelementptr inbounds %struct.drflac_cuesheet_track_iterator, ptr %91, i32 0, i32 0
  %93 = load i32, ptr %92, align 8, !tbaa !9
  %94 = sub i32 %93, 1
  store i32 %94, ptr %92, align 8, !tbaa !9
  %95 = load ptr, ptr %5, align 8, !tbaa !5
  %96 = icmp ne ptr %95, null
  br i1 %96, label %97, label %99

97:                                               ; preds = %24
  %98 = load ptr, ptr %5, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %98, ptr align 8 %6, i64 32, i1 false), !tbaa.struct !24
  br label %99

99:                                               ; preds = %97, %24
  store i32 1, ptr %3, align 4
  store i32 1, ptr %10, align 4
  br label %100

100:                                              ; preds = %99, %23
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr %6) #4
  %101 = load i32, ptr %3, align 4
  ret i32 %101
}

; Function Attrs: alwaysinline mustprogress uwtable
declare hidden noundef i32 @_ZL18drflac__be2host_32j(i32 noundef) #3

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 = { alwaysinline 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 = { 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, !11, i64 0}
!10 = !{!"_ZTS30drflac_cuesheet_track_iterator", !11, i64 0, !6, i64 8}
!11 = !{!"int", !7, i64 0}
!12 = !{!10, !6, i64 8}
!13 = !{!11, !11, i64 0}
!14 = !{!15, !15, i64 0}
!15 = !{!"long long", !7, i64 0}
!16 = !{!17, !15, i64 0}
!17 = !{!"_ZTS21drflac_cuesheet_track", !15, i64 0, !7, i64 8, !7, i64 9, !7, i64 21, !7, i64 22, !7, i64 23, !6, i64 24}
!18 = !{!7, !7, i64 0}
!19 = !{!17, !7, i64 8}
!20 = !{!17, !7, i64 21}
!21 = !{!17, !7, i64 22}
!22 = !{!17, !7, i64 23}
!23 = !{!17, !6, i64 24}
!24 = !{i64 0, i64 8, !14, i64 8, i64 1, !18, i64 9, i64 12, !18, i64 21, i64 1, !18, i64 22, i64 1, !18, i64 23, i64 1, !18, i64 24, i64 8, !5}


; 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 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
define dso_local range(i32 0, 2) i32 @drflac_next_cuesheet_track(ptr noundef %0, ptr noundef writeonly %1) local_unnamed_addr #2 {
  %.sroa.5 = alloca [12 x i8], align 1
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %.sroa.5)
  %3 = icmp eq ptr %0, null
  br i1 %3, label %37, label %4

4:                                                ; preds = %2
  %5 = load i32, ptr %0, align 8, !tbaa !5
  %6 = icmp eq i32 %5, 0
  br i1 %6, label %37, label %7

7:                                                ; preds = %4
  %8 = getelementptr inbounds i8, ptr %0, i64 8
  %9 = load ptr, ptr %8, align 8, !tbaa !11
  %10 = icmp eq ptr %9, null
  br i1 %10, label %37, label %11

11:                                               ; preds = %7
  %12 = load i32, ptr %9, align 4, !tbaa !12
  %13 = tail call noundef i32 @_ZL18drflac__be2host_32j(i32 noundef %12)
  %14 = getelementptr inbounds i8, ptr %9, i64 4
  %15 = load i32, ptr %14, align 4, !tbaa !12
  %16 = tail call noundef i32 @_ZL18drflac__be2host_32j(i32 noundef %15)
  %17 = getelementptr inbounds i8, ptr %9, i64 8
  %18 = load i8, ptr %17, align 1, !tbaa !13
  %19 = getelementptr inbounds i8, ptr %9, i64 9
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(12) %.sroa.5, ptr noundef nonnull align 1 dereferenceable(12) %19, i64 12, i1 false)
  %20 = getelementptr inbounds i8, ptr %9, i64 21
  %21 = load i8, ptr %20, align 1, !tbaa !13
  %22 = getelementptr inbounds i8, ptr %9, i64 35
  %23 = load i8, ptr %22, align 1, !tbaa !13
  %24 = getelementptr inbounds i8, ptr %9, i64 36
  %25 = zext i8 %23 to i64
  %26 = mul nuw nsw i64 %25, 12
  %27 = getelementptr inbounds i8, ptr %24, i64 %26
  store ptr %27, ptr %8, align 8, !tbaa !11
  %28 = load i32, ptr %0, align 8, !tbaa !5
  %29 = add i32 %28, -1
  store i32 %29, ptr %0, align 8, !tbaa !5
  %.not = icmp eq ptr %1, null
  br i1 %.not, label %37, label %30

30:                                               ; preds = %11
  %31 = lshr i8 %21, 6
  %32 = and i8 %31, 1
  %.lobit = lshr i8 %21, 7
  %33 = zext i32 %16 to i64
  %34 = zext i32 %13 to i64
  %35 = shl nuw i64 %34, 32
  %36 = or disjoint i64 %35, %33
  store i64 %36, ptr %1, align 8, !tbaa !14
  %.sroa.4.0..sroa_idx = getelementptr inbounds i8, ptr %1, i64 8
  store i8 %18, ptr %.sroa.4.0..sroa_idx, align 8, !tbaa !13
  %.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %1, i64 9
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(12) %.sroa.5.0..sroa_idx, ptr noundef nonnull align 1 dereferenceable(12) %.sroa.5, i64 12, i1 false), !tbaa.struct !16
  %.sroa.6.0..sroa_idx = getelementptr inbounds i8, ptr %1, i64 21
  store i8 %.lobit, ptr %.sroa.6.0..sroa_idx, align 1, !tbaa !13
  %.sroa.7.0..sroa_idx = getelementptr inbounds i8, ptr %1, i64 22
  store i8 %32, ptr %.sroa.7.0..sroa_idx, align 2, !tbaa !13
  %.sroa.8.0..sroa_idx = getelementptr inbounds i8, ptr %1, i64 23
  store i8 %23, ptr %.sroa.8.0..sroa_idx, align 1, !tbaa !13
  %.sroa.10.0..sroa_idx = getelementptr inbounds i8, ptr %1, i64 24
  store ptr %24, ptr %.sroa.10.0..sroa_idx, align 8, !tbaa !17
  br label %37

37:                                               ; preds = %11, %30, %2, %4, %7
  %.0 = phi i32 [ 0, %7 ], [ 0, %4 ], [ 0, %2 ], [ 1, %30 ], [ 1, %11 ]
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %.sroa.5)
  ret i32 %.0
}

; Function Attrs: alwaysinline mustprogress uwtable
declare hidden noundef i32 @_ZL18drflac__be2host_32j(i32 noundef) local_unnamed_addr #3

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 = { alwaysinline 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, !7, i64 0}
!6 = !{!"_ZTS30drflac_cuesheet_track_iterator", !7, i64 0, !10, i64 8}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!6, !10, i64 8}
!12 = !{!7, !7, i64 0}
!13 = !{!8, !8, i64 0}
!14 = !{!15, !15, i64 0}
!15 = !{!"long long", !8, i64 0}
!16 = !{i64 0, i64 12, !13, i64 12, i64 1, !13, i64 13, i64 1, !13, i64 14, i64 1, !13, i64 15, i64 8, !17}
!17 = !{!10, !10, i64 0}


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