; LLVM IR from Overload-Technologies/Overload :: Dependencies/soloud/src/audiosource/monotone (soloud_monotone)

; 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"

%"class.SoLoud::Monotone" = type { %"class.SoLoud::AudioSource", [800 x i32], [32 x i32], i32, i32, %"struct.SoLoud::MonotoneSong" }
%"class.SoLoud::AudioSource" = type { ptr, i32, float, float, i32, i32, float, float, float, i32, float, [8 x ptr], ptr, ptr, ptr, i32, double }
%"struct.SoLoud::MonotoneSong" = type { ptr, ptr, i8, i8, i8, i8, [256 x i8], ptr }

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN6SoLoud8Monotone5clearEv(ptr noundef nonnull align 8 dereferenceable(3776) %0) #0 align 2 {
  %2 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %3 = load ptr, ptr %2, align 8
  call void @_ZN6SoLoud11AudioSource4stopEv(ptr noundef nonnull align 8 dereferenceable(152) %3)
  %4 = getelementptr inbounds %"class.SoLoud::Monotone", ptr %3, i32 0, i32 5
  %5 = getelementptr inbounds %"struct.SoLoud::MonotoneSong", ptr %4, i32 0, i32 0
  %6 = load ptr, ptr %5, align 8, !tbaa !9
  %7 = icmp eq ptr %6, null
  br i1 %7, label %9, label %8

8:                                                ; preds = %1
  call void @_ZdaPv(ptr noundef %6) #3
  br label %9

9:                                                ; preds = %8, %1
  %10 = getelementptr inbounds %"class.SoLoud::Monotone", ptr %3, i32 0, i32 5
  %11 = getelementptr inbounds %"struct.SoLoud::MonotoneSong", ptr %10, i32 0, i32 1
  %12 = load ptr, ptr %11, align 8, !tbaa !16
  %13 = icmp eq ptr %12, null
  br i1 %13, label %15, label %14

14:                                               ; preds = %9
  call void @_ZdaPv(ptr noundef %12) #3
  br label %15

15:                                               ; preds = %14, %9
  %16 = getelementptr inbounds %"class.SoLoud::Monotone", ptr %3, i32 0, i32 5
  %17 = getelementptr inbounds %"struct.SoLoud::MonotoneSong", ptr %16, i32 0, i32 7
  %18 = load ptr, ptr %17, align 8, !tbaa !17
  %19 = icmp eq ptr %18, null
  br i1 %19, label %21, label %20

20:                                               ; preds = %15
  call void @_ZdaPv(ptr noundef %18) #3
  br label %21

21:                                               ; preds = %20, %15
  %22 = getelementptr inbounds %"class.SoLoud::Monotone", ptr %3, i32 0, i32 5
  %23 = getelementptr inbounds %"struct.SoLoud::MonotoneSong", ptr %22, i32 0, i32 0
  store ptr null, ptr %23, align 8, !tbaa !9
  %24 = getelementptr inbounds %"class.SoLoud::Monotone", ptr %3, i32 0, i32 5
  %25 = getelementptr inbounds %"struct.SoLoud::MonotoneSong", ptr %24, i32 0, i32 1
  store ptr null, ptr %25, align 8, !tbaa !16
  %26 = getelementptr inbounds %"class.SoLoud::Monotone", ptr %3, i32 0, i32 5
  %27 = getelementptr inbounds %"struct.SoLoud::MonotoneSong", ptr %26, i32 0, i32 7
  store ptr null, ptr %27, align 8, !tbaa !17
  ret void
}

declare void @_ZN6SoLoud11AudioSource4stopEv(ptr noundef nonnull align 8 dereferenceable(152)) #1

; Function Attrs: nobuiltin nounwind
declare void @_ZdaPv(ptr noundef) #2

attributes #0 = { 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 #1 = { "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 = { nobuiltin 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 #3 = { builtin 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, !6, i64 3488}
!10 = !{!"_ZTSN6SoLoud8MonotoneE", !11, i64 0, !7, i64 152, !7, i64 3352, !12, i64 3480, !12, i64 3484, !15, i64 3488}
!11 = !{!"_ZTSN6SoLoud11AudioSourceE", !12, i64 8, !13, i64 12, !13, i64 16, !12, i64 20, !12, i64 24, !13, i64 28, !13, i64 32, !13, i64 36, !12, i64 40, !13, i64 44, !7, i64 48, !6, i64 112, !6, i64 120, !6, i64 128, !12, i64 136, !14, i64 144}
!12 = !{!"int", !7, i64 0}
!13 = !{!"float", !7, i64 0}
!14 = !{!"double", !7, i64 0}
!15 = !{!"_ZTSN6SoLoud12MonotoneSongE", !6, i64 0, !6, i64 8, !7, i64 16, !7, i64 17, !7, i64 18, !7, i64 19, !7, i64 20, !6, i64 280}
!16 = !{!10, !6, i64 3496}
!17 = !{!10, !6, i64 3768}


; 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 uwtable
define dso_local void @_ZN6SoLoud8Monotone5clearEv(ptr noundef nonnull align 8 dereferenceable(3776) %0) local_unnamed_addr #0 align 2 {
  tail call void @_ZN6SoLoud11AudioSource4stopEv(ptr noundef nonnull align 8 dereferenceable(152) %0)
  %2 = getelementptr inbounds i8, ptr %0, i64 3488
  %3 = load ptr, ptr %2, align 8, !tbaa !5
  %4 = icmp eq ptr %3, null
  br i1 %4, label %6, label %5

5:                                                ; preds = %1
  tail call void @_ZdaPv(ptr noundef nonnull %3) #4
  br label %6

6:                                                ; preds = %5, %1
  %7 = getelementptr inbounds i8, ptr %0, i64 3496
  %8 = load ptr, ptr %7, align 8, !tbaa !15
  %9 = icmp eq ptr %8, null
  br i1 %9, label %11, label %10

10:                                               ; preds = %6
  tail call void @_ZdaPv(ptr noundef nonnull %8) #4
  br label %11

11:                                               ; preds = %10, %6
  %12 = getelementptr inbounds i8, ptr %0, i64 3768
  %13 = load ptr, ptr %12, align 8, !tbaa !16
  %14 = icmp eq ptr %13, null
  br i1 %14, label %16, label %15

15:                                               ; preds = %11
  tail call void @_ZdaPv(ptr noundef nonnull %13) #4
  br label %16

16:                                               ; preds = %15, %11
  store ptr null, ptr %12, align 8, !tbaa !16
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %2, i8 0, i64 16, i1 false)
  ret void
}

declare void @_ZN6SoLoud11AudioSource4stopEv(ptr noundef nonnull align 8 dereferenceable(152)) local_unnamed_addr #1

; Function Attrs: nobuiltin nounwind
declare void @_ZdaPv(ptr noundef) local_unnamed_addr #2

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

attributes #0 = { 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 #1 = { "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 = { nobuiltin 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 #3 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { builtin 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, !12, i64 3488}
!6 = !{!"_ZTSN6SoLoud8MonotoneE", !7, i64 0, !9, i64 152, !9, i64 3352, !8, i64 3480, !8, i64 3484, !14, i64 3488}
!7 = !{!"_ZTSN6SoLoud11AudioSourceE", !8, i64 8, !11, i64 12, !11, i64 16, !8, i64 20, !8, i64 24, !11, i64 28, !11, i64 32, !11, i64 36, !8, i64 40, !11, i64 44, !9, i64 48, !12, i64 112, !12, i64 120, !12, i64 128, !8, i64 136, !13, i64 144}
!8 = !{!"int", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = !{!"float", !9, i64 0}
!12 = !{!"any pointer", !9, i64 0}
!13 = !{!"double", !9, i64 0}
!14 = !{!"_ZTSN6SoLoud12MonotoneSongE", !12, i64 0, !12, i64 8, !9, i64 16, !9, i64 17, !9, i64 18, !9, i64 19, !9, i64 20, !12, i64 280}
!15 = !{!6, !12, i64 3496}
!16 = !{!6, !12, i64 3768}


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