; LLVM IR from merpheus-dev/LavaEngine :: src/Utils/soloud/src/audiosource/wav/dr_impl.ll (Z11drmp3_resetP5drmp3)

; 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 = 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, %struct.drmp3_src, ptr, i32, i64, i64, ptr, i8, %struct.anon.0 }
%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.drmp3_allocation_callbacks = type { ptr, ptr, ptr, ptr }
%struct.drmp3_src = type { %struct.drmp3_src_config, ptr, ptr, [256 x float], %struct.drmp3_src_cache, %union.anon }
%struct.drmp3_src_config = type { i32, i32, i32, i32, i32 }
%struct.drmp3_src_cache = type { ptr, [1024 x float], i32, i32 }
%union.anon = type { %struct.anon }
%struct.anon = type { double, i8 }
%struct.anon.0 = type { ptr, i64, i64 }

@.str.1 = external hidden unnamed_addr constant [103 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [15 x i8], align 1
@__PRETTY_FUNCTION__._Z11drmp3_resetP5drmp3 = external hidden unnamed_addr constant [26 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @drmp3dec_init(ptr noundef) #0

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #1

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_Z11drmp3_resetP5drmp3(ptr noundef %0) #0 {
  %2 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %3 = load ptr, ptr %2, align 8, !tbaa !5
  %4 = icmp ne ptr %3, null
  br i1 %4, label %5, label %6

5:                                                ; preds = %1
  br label %8

6:                                                ; preds = %1
  call void @__assert_fail(ptr noundef @.str.7, ptr noundef @.str.1, i32 noundef 3273, ptr noundef @__PRETTY_FUNCTION__._Z11drmp3_resetP5drmp3) #2
  unreachable

7:                                                ; No predecessors!
  br label %8

8:                                                ; preds = %7, %5
  %9 = load ptr, ptr %2, align 8, !tbaa !5
  %10 = getelementptr inbounds %struct.drmp3, ptr %9, i32 0, i32 10
  store i32 0, ptr %10, align 8, !tbaa !9
  %11 = load ptr, ptr %2, align 8, !tbaa !5
  %12 = getelementptr inbounds %struct.drmp3, ptr %11, i32 0, i32 11
  store i32 0, ptr %12, align 4, !tbaa !21
  %13 = load ptr, ptr %2, align 8, !tbaa !5
  %14 = getelementptr inbounds %struct.drmp3, ptr %13, i32 0, i32 13
  store i64 0, ptr %14, align 8, !tbaa !22
  %15 = load ptr, ptr %2, align 8, !tbaa !5
  %16 = getelementptr inbounds %struct.drmp3, ptr %15, i32 0, i32 18
  store i64 0, ptr %16, align 8, !tbaa !23
  %17 = load ptr, ptr %2, align 8, !tbaa !5
  %18 = getelementptr inbounds %struct.drmp3, ptr %17, i32 0, i32 21
  %19 = load i8, ptr %18, align 8
  %20 = and i8 %19, -2
  %21 = or i8 %20, 0
  store i8 %21, ptr %18, align 8
  %22 = load ptr, ptr %2, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.drmp3, ptr %22, i32 0, i32 15
  %24 = getelementptr inbounds %struct.drmp3_src, ptr %23, i32 0, i32 3
  %25 = getelementptr inbounds [256 x float], ptr %24, i64 0, i64 0
  store float 0.000000e+00, ptr %25, align 8, !tbaa !24
  %26 = load ptr, ptr %2, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.drmp3, ptr %26, i32 0, i32 15
  %28 = getelementptr inbounds %struct.drmp3_src, ptr %27, i32 0, i32 3
  %29 = getelementptr inbounds [256 x float], ptr %28, i64 0, i64 1
  store float 0.000000e+00, ptr %29, align 4, !tbaa !24
  %30 = load ptr, ptr %2, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.drmp3, ptr %30, i32 0, i32 15
  %32 = getelementptr inbounds %struct.drmp3_src, ptr %31, i32 0, i32 3
  %33 = getelementptr inbounds [256 x float], ptr %32, i64 0, i64 2
  store float 0.000000e+00, ptr %33, align 8, !tbaa !24
  %34 = load ptr, ptr %2, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct.drmp3, ptr %34, i32 0, i32 15
  %36 = getelementptr inbounds %struct.drmp3_src, ptr %35, i32 0, i32 3
  %37 = getelementptr inbounds [256 x float], ptr %36, i64 0, i64 3
  store float 0.000000e+00, ptr %37, align 4, !tbaa !24
  %38 = load ptr, ptr %2, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.drmp3, ptr %38, i32 0, i32 15
  %40 = getelementptr inbounds %struct.drmp3_src, ptr %39, i32 0, i32 4
  %41 = getelementptr inbounds %struct.drmp3_src_cache, ptr %40, i32 0, i32 2
  store i32 0, ptr %41, align 8, !tbaa !26
  %42 = load ptr, ptr %2, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.drmp3, ptr %42, i32 0, i32 15
  %44 = getelementptr inbounds %struct.drmp3_src, ptr %43, i32 0, i32 4
  %45 = getelementptr inbounds %struct.drmp3_src_cache, ptr %44, i32 0, i32 3
  store i32 0, ptr %45, align 4, !tbaa !27
  %46 = load ptr, ptr %2, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.drmp3, ptr %46, i32 0, i32 15
  %48 = getelementptr inbounds %struct.drmp3_src, ptr %47, i32 0, i32 5
  %49 = getelementptr inbounds %struct.anon, ptr %48, i32 0, i32 0
  store double 0.000000e+00, ptr %49, align 8, !tbaa !28
  %50 = load ptr, ptr %2, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct.drmp3, ptr %50, i32 0, i32 15
  %52 = getelementptr inbounds %struct.drmp3_src, ptr %51, i32 0, i32 5
  %53 = getelementptr inbounds %struct.anon, ptr %52, i32 0, i32 1
  %54 = load i8, ptr %53, align 8
  %55 = and i8 %54, -3
  %56 = or i8 %55, 0
  store i8 %56, ptr %53, align 8
  %57 = load ptr, ptr %2, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct.drmp3, ptr %57, i32 0, i32 15
  %59 = getelementptr inbounds %struct.drmp3_src, ptr %58, i32 0, i32 5
  %60 = getelementptr inbounds %struct.anon, ptr %59, i32 0, i32 1
  %61 = load i8, ptr %60, align 8
  %62 = and i8 %61, -2
  %63 = or i8 %62, 0
  store i8 %63, ptr %60, align 8
  %64 = load ptr, ptr %2, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct.drmp3, ptr %64, i32 0, i32 0
  call void @drmp3dec_init(ptr noundef %65)
  ret void
}

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 = { noreturn nounwind "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 = { noreturn 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, !12, i64 6760}
!10 = !{!"_ZTS5drmp3", !11, i64 0, !13, i64 6668, !12, i64 6688, !12, i64 6692, !6, i64 6696, !6, i64 6704, !6, i64 6712, !14, i64 6720, !12, i64 6752, !12, i64 6756, !12, i64 6760, !12, i64 6764, !7, i64 6768, !15, i64 15984, !15, i64 15992, !16, i64 16000, !6, i64 21192, !12, i64 21200, !15, i64 21208, !15, i64 21216, !6, i64 21224, !12, i64 21232, !20, i64 21240}
!11 = !{!"_ZTS8drmp3dec", !7, i64 0, !7, i64 2304, !12, i64 6144, !12, i64 6148, !7, i64 6152, !7, i64 6156}
!12 = !{!"int", !7, i64 0}
!13 = !{!"_ZTS19drmp3dec_frame_info", !12, i64 0, !12, i64 4, !12, i64 8, !12, i64 12, !12, i64 16}
!14 = !{!"_ZTS26drmp3_allocation_callbacks", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!15 = !{!"long", !7, i64 0}
!16 = !{!"_ZTS9drmp3_src", !17, i64 0, !6, i64 24, !6, i64 32, !7, i64 40, !19, i64 1064, !7, i64 5176}
!17 = !{!"_ZTS16drmp3_src_config", !12, i64 0, !12, i64 4, !12, i64 8, !18, i64 12, !12, i64 16}
!18 = !{!"_ZTS19drmp3_src_algorithm", !7, i64 0}
!19 = !{!"_ZTS15drmp3_src_cache", !6, i64 0, !7, i64 8, !12, i64 4104, !12, i64 4108}
!20 = !{!"_ZTSN5drmp3Ut_E", !6, i64 0, !15, i64 8, !15, i64 16}
!21 = !{!10, !12, i64 6764}
!22 = !{!10, !15, i64 15984}
!23 = !{!10, !15, i64 21208}
!24 = !{!25, !25, i64 0}
!25 = !{!"float", !7, i64 0}
!26 = !{!10, !12, i64 21168}
!27 = !{!10, !12, i64 21172}
!28 = !{!7, !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"

@.str.1 = external hidden unnamed_addr constant [103 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [15 x i8], align 1
@__PRETTY_FUNCTION__._Z11drmp3_resetP5drmp3 = external hidden unnamed_addr constant [26 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @drmp3dec_init(ptr noundef) local_unnamed_addr #0

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_Z11drmp3_resetP5drmp3(ptr noundef %0) local_unnamed_addr #0 {
  %.not = icmp eq ptr %0, null
  br i1 %.not, label %2, label %3

2:                                                ; preds = %1
  tail call void @__assert_fail(ptr noundef nonnull @.str.7, ptr noundef nonnull @.str.1, i32 noundef 3273, ptr noundef nonnull @__PRETTY_FUNCTION__._Z11drmp3_resetP5drmp3) #3
  unreachable

3:                                                ; preds = %1
  %4 = getelementptr inbounds i8, ptr %0, i64 6760
  store i32 0, ptr %4, align 8, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %0, i64 6764
  store i32 0, ptr %5, align 4, !tbaa !20
  %6 = getelementptr inbounds i8, ptr %0, i64 15984
  store i64 0, ptr %6, align 8, !tbaa !21
  %7 = getelementptr inbounds i8, ptr %0, i64 21208
  store i64 0, ptr %7, align 8, !tbaa !22
  %8 = getelementptr inbounds i8, ptr %0, i64 21232
  %9 = load i8, ptr %8, align 8
  %10 = and i8 %9, -2
  store i8 %10, ptr %8, align 8
  %11 = getelementptr inbounds i8, ptr %0, i64 16040
  %12 = getelementptr inbounds i8, ptr %0, i64 21168
  %13 = getelementptr inbounds i8, ptr %0, i64 21184
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %11, i8 0, i64 16, i1 false)
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %12, i8 0, i64 16, i1 false)
  %14 = load i8, ptr %13, align 8
  %15 = and i8 %14, -4
  store i8 %15, ptr %13, align 8
  tail call void @drmp3dec_init(ptr noundef nonnull %0)
  ret void
}

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

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 = { noreturn nounwind "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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { noreturn 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, !10, i64 6760}
!6 = !{!"_ZTS5drmp3", !7, i64 0, !11, i64 6668, !10, i64 6688, !10, i64 6692, !12, i64 6696, !12, i64 6704, !12, i64 6712, !13, i64 6720, !10, i64 6752, !10, i64 6756, !10, i64 6760, !10, i64 6764, !8, i64 6768, !14, i64 15984, !14, i64 15992, !15, i64 16000, !12, i64 21192, !10, i64 21200, !14, i64 21208, !14, i64 21216, !12, i64 21224, !10, i64 21232, !19, i64 21240}
!7 = !{!"_ZTS8drmp3dec", !8, i64 0, !8, i64 2304, !10, i64 6144, !10, i64 6148, !8, i64 6152, !8, i64 6156}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!"_ZTS19drmp3dec_frame_info", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16}
!12 = !{!"any pointer", !8, i64 0}
!13 = !{!"_ZTS26drmp3_allocation_callbacks", !12, i64 0, !12, i64 8, !12, i64 16, !12, i64 24}
!14 = !{!"long", !8, i64 0}
!15 = !{!"_ZTS9drmp3_src", !16, i64 0, !12, i64 24, !12, i64 32, !8, i64 40, !18, i64 1064, !8, i64 5176}
!16 = !{!"_ZTS16drmp3_src_config", !10, i64 0, !10, i64 4, !10, i64 8, !17, i64 12, !10, i64 16}
!17 = !{!"_ZTS19drmp3_src_algorithm", !8, i64 0}
!18 = !{!"_ZTS15drmp3_src_cache", !12, i64 0, !8, i64 8, !10, i64 4104, !10, i64 4108}
!19 = !{!"_ZTSN5drmp3Ut_E", !12, i64 0, !14, i64 8, !14, i64 16}
!20 = !{!6, !10, i64 6764}
!21 = !{!6, !14, i64 15984}
!22 = !{!6, !14, i64 21208}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InstCombinePass,MemCpyOptPass,SROAPass,SimplifyCFGPass,TailCallElimPass