; LLVM IR from Overload-Technologies/Overload :: Dependencies/soloud/src/core (soloud_core_voiceops)

; 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::Soloud" = type <{ ptr, ptr, i8, [7 x i8], ptr, ptr, ptr, i32, i32, %"class.SoLoud::AlignedFloatBuffer", i32, [4 x i8], %"class.SoLoud::AlignedFloatBuffer", ptr, %"class.SoLoud::AlignedFloatBuffer", ptr, [1024 x ptr], i32, i32, i32, i32, ptr, i32, i32, float, float, i32, i32, %"class.SoLoud::Fader", double, double, [8 x ptr], [8 x ptr], [8 x float], [256 x float], [256 x float], [256 x float], [3 x float], [3 x float], [3 x float], [3 x float], float, [24 x float], [4 x i8], [1024 x %"class.SoLoud::AudioSourceInstance3dData"], ptr, i32, [1024 x i32], i32, i8, [7 x i8] }>
%"class.SoLoud::AlignedFloatBuffer" = type <{ ptr, ptr, i32, [4 x i8] }>
%"class.SoLoud::Fader" = type { float, float, float, double, double, double, float, i32 }
%"class.SoLoud::AudioSourceInstance3dData" = type <{ [3 x float], [3 x float], float, float, float, i32, float, [4 x i8], ptr, ptr, i32, float, float, [8 x float], i32, i32, [4 x i8] }>
%"class.SoLoud::AudioSourceInstance" = type { ptr, i32, i32, i32, float, [8 x float], float, float, float, float, i32, float, float, double, double, %"class.SoLoud::Fader", %"class.SoLoud::Fader", %"class.SoLoud::Fader", %"class.SoLoud::Fader", %"class.SoLoud::Fader", i32, [8 x float], i32, i32, [8 x ptr], [2 x ptr], i32, i32, i32, double }

@.str = external hidden unnamed_addr constant [14 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [118 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [24 x i8], align 1
@__PRETTY_FUNCTION__._ZN6SoLoud6Soloud26updateVoiceVolume_internalEj = external hidden unnamed_addr constant [62 x i8], align 1

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

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN6SoLoud6Soloud26updateVoiceVolume_internalEj(ptr noundef nonnull align 8 dereferenceable(138833) %0, i32 noundef %1) #2 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store i32 %1, ptr %4, align 4, !tbaa !9
  %6 = load ptr, ptr %3, align 8
  %7 = load i32, ptr %4, align 4, !tbaa !9
  %8 = icmp ult i32 %7, 1024
  br i1 %8, label %9, label %10

9:                                                ; preds = %2
  br label %12

10:                                               ; preds = %2
  call void @__assert_fail(ptr noundef @.str, ptr noundef @.str.1, i32 noundef 150, ptr noundef @__PRETTY_FUNCTION__._ZN6SoLoud6Soloud26updateVoiceVolume_internalEj) #3
  unreachable

11:                                               ; No predecessors!
  br label %12

12:                                               ; preds = %11, %9
  %13 = getelementptr inbounds %"class.SoLoud::Soloud", ptr %6, i32 0, i32 2
  %14 = load i8, ptr %13, align 8, !tbaa !11, !range !18, !noundef !19
  %15 = trunc i8 %14 to i1
  br i1 %15, label %16, label %17

16:                                               ; preds = %12
  br label %19

17:                                               ; preds = %12
  call void @__assert_fail(ptr noundef @.str.2, ptr noundef @.str.1, i32 noundef 151, ptr noundef @__PRETTY_FUNCTION__._ZN6SoLoud6Soloud26updateVoiceVolume_internalEj) #3
  unreachable

18:                                               ; No predecessors!
  br label %19

19:                                               ; preds = %18, %16
  %20 = getelementptr inbounds %"class.SoLoud::Soloud", ptr %6, i32 0, i32 16
  %21 = load i32, ptr %4, align 4, !tbaa !9
  %22 = zext i32 %21 to i64
  %23 = getelementptr inbounds [1024 x ptr], ptr %20, i64 0, i64 %22
  %24 = load ptr, ptr %23, align 8, !tbaa !5
  %25 = getelementptr inbounds %"class.SoLoud::AudioSourceInstance", ptr %24, i32 0, i32 6
  %26 = load float, ptr %25, align 8, !tbaa !20
  %27 = getelementptr inbounds %"class.SoLoud::Soloud", ptr %6, i32 0, i32 44
  %28 = load i32, ptr %4, align 4, !tbaa !9
  %29 = zext i32 %28 to i64
  %30 = getelementptr inbounds [1024 x %"class.SoLoud::AudioSourceInstance3dData"], ptr %27, i64 0, i64 %29
  %31 = getelementptr inbounds %"class.SoLoud::AudioSourceInstance3dData", ptr %30, i32 0, i32 12
  %32 = load float, ptr %31, align 8, !tbaa !22
  %33 = fmul float %26, %32
  %34 = getelementptr inbounds %"class.SoLoud::Soloud", ptr %6, i32 0, i32 16
  %35 = load i32, ptr %4, align 4, !tbaa !9
  %36 = zext i32 %35 to i64
  %37 = getelementptr inbounds [1024 x ptr], ptr %34, i64 0, i64 %36
  %38 = load ptr, ptr %37, align 8, !tbaa !5
  %39 = getelementptr inbounds %"class.SoLoud::AudioSourceInstance", ptr %38, i32 0, i32 7
  store float %33, ptr %39, align 4, !tbaa !24
  %40 = getelementptr inbounds %"class.SoLoud::Soloud", ptr %6, i32 0, i32 16
  %41 = load i32, ptr %4, align 4, !tbaa !9
  %42 = zext i32 %41 to i64
  %43 = getelementptr inbounds [1024 x ptr], ptr %40, i64 0, i64 %42
  %44 = load ptr, ptr %43, align 8, !tbaa !5
  %45 = getelementptr inbounds %"class.SoLoud::AudioSourceInstance", ptr %44, i32 0, i32 3
  %46 = load i32, ptr %45, align 8, !tbaa !25
  %47 = and i32 %46, 4
  %48 = icmp ne i32 %47, 0
  br i1 %48, label %49, label %85

49:                                               ; preds = %19
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  store i32 0, ptr %5, align 4, !tbaa !9
  br label %50

50:                                               ; preds = %81, %49
  %51 = load i32, ptr %5, align 4, !tbaa !9
  %52 = icmp slt i32 %51, 8
  br i1 %52, label %53, label %84

53:                                               ; preds = %50
  %54 = getelementptr inbounds %"class.SoLoud::Soloud", ptr %6, i32 0, i32 16
  %55 = load i32, ptr %4, align 4, !tbaa !9
  %56 = zext i32 %55 to i64
  %57 = getelementptr inbounds [1024 x ptr], ptr %54, i64 0, i64 %56
  %58 = load ptr, ptr %57, align 8, !tbaa !5
  %59 = getelementptr inbounds %"class.SoLoud::AudioSourceInstance", ptr %58, i32 0, i32 5
  %60 = load i32, ptr %5, align 4, !tbaa !9
  %61 = sext i32 %60 to i64
  %62 = getelementptr inbounds [8 x float], ptr %59, i64 0, i64 %61
  %63 = load float, ptr %62, align 4, !tbaa !26
  %64 = getelementptr inbounds %"class.SoLoud::Soloud", ptr %6, i32 0, i32 16
  %65 = load i32, ptr %4, align 4, !tbaa !9
  %66 = zext i32 %65 to i64
  %67 = getelementptr inbounds [1024 x ptr], ptr %64, i64 0, i64 %66
  %68 = load ptr, ptr %67, align 8, !tbaa !5
  %69 = getelementptr inbounds %"class.SoLoud::AudioSourceInstance", ptr %68, i32 0, i32 7
  %70 = load float, ptr %69, align 4, !tbaa !24
  %71 = fmul float %63, %70
  %72 = getelementptr inbounds %"class.SoLoud::Soloud", ptr %6, i32 0, i32 16
  %73 = load i32, ptr %4, align 4, !tbaa !9
  %74 = zext i32 %73 to i64
  %75 = getelementptr inbounds [1024 x ptr], ptr %72, i64 0, i64 %74
  %76 = load ptr, ptr %75, align 8, !tbaa !5
  %77 = getelementptr inbounds %"class.SoLoud::AudioSourceInstance", ptr %76, i32 0, i32 21
  %78 = load i32, ptr %5, align 4, !tbaa !9
  %79 = sext i32 %78 to i64
  %80 = getelementptr inbounds [8 x float], ptr %77, i64 0, i64 %79
  store float %71, ptr %80, align 4, !tbaa !26
  br label %81

81:                                               ; preds = %53
  %82 = load i32, ptr %5, align 4, !tbaa !9
  %83 = add nsw i32 %82, 1
  store i32 %83, ptr %5, align 4, !tbaa !9
  br label %50, !llvm.loop !27

84:                                               ; preds = %50
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  br label %85

85:                                               ; preds = %84, %19
  ret void
}

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { noreturn nounwind }
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 = !{!"int", !7, i64 0}
!11 = !{!12, !13, i64 16}
!12 = !{!"_ZTSN6SoLoud6SoloudE", !6, i64 0, !6, i64 8, !13, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !10, i64 48, !10, i64 52, !14, i64 56, !10, i64 80, !14, i64 88, !6, i64 112, !14, i64 120, !6, i64 144, !7, i64 152, !10, i64 8344, !10, i64 8348, !10, i64 8352, !10, i64 8356, !6, i64 8360, !10, i64 8368, !10, i64 8372, !15, i64 8376, !15, i64 8380, !10, i64 8384, !10, i64 8388, !16, i64 8392, !17, i64 8440, !17, i64 8448, !7, i64 8456, !7, i64 8520, !7, i64 8584, !7, i64 8616, !7, i64 9640, !7, i64 10664, !7, i64 11688, !7, i64 11700, !7, i64 11712, !7, i64 11724, !15, i64 11736, !7, i64 11740, !7, i64 11840, !6, i64 134720, !10, i64 134728, !7, i64 134732, !10, i64 138828, !13, i64 138832}
!13 = !{!"bool", !7, i64 0}
!14 = !{!"_ZTSN6SoLoud18AlignedFloatBufferE", !6, i64 0, !6, i64 8, !10, i64 16}
!15 = !{!"float", !7, i64 0}
!16 = !{!"_ZTSN6SoLoud5FaderE", !15, i64 0, !15, i64 4, !15, i64 8, !17, i64 16, !17, i64 24, !17, i64 32, !15, i64 40, !10, i64 44}
!17 = !{!"double", !7, i64 0}
!18 = !{i8 0, i8 2}
!19 = !{}
!20 = !{!21, !15, i64 56}
!21 = !{!"_ZTSN6SoLoud19AudioSourceInstanceE", !10, i64 8, !10, i64 12, !10, i64 16, !15, i64 20, !7, i64 24, !15, i64 56, !15, i64 60, !15, i64 64, !15, i64 68, !10, i64 72, !15, i64 76, !15, i64 80, !17, i64 88, !17, i64 96, !16, i64 104, !16, i64 152, !16, i64 200, !16, i64 248, !16, i64 296, !10, i64 344, !7, i64 348, !10, i64 380, !10, i64 384, !7, i64 392, !7, i64 456, !10, i64 472, !10, i64 476, !10, i64 480, !17, i64 488}
!22 = !{!23, !15, i64 72}
!23 = !{!"_ZTSN6SoLoud25AudioSourceInstance3dDataE", !7, i64 0, !7, i64 12, !15, i64 24, !15, i64 28, !15, i64 32, !10, i64 36, !15, i64 40, !6, i64 48, !6, i64 56, !10, i64 64, !15, i64 68, !15, i64 72, !7, i64 76, !10, i64 108, !10, i64 112}
!24 = !{!21, !15, i64 60}
!25 = !{!21, !10, i64 16}
!26 = !{!15, !15, i64 0}
!27 = distinct !{!27, !28}
!28 = !{!"llvm.loop.mustprogress"}


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

%"class.SoLoud::AudioSourceInstance3dData" = type <{ [3 x float], [3 x float], float, float, float, i32, float, [4 x i8], ptr, ptr, i32, float, float, [8 x float], i32, i32, [4 x i8] }>

@.str = external hidden unnamed_addr constant [14 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [118 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [24 x i8], align 1
@__PRETTY_FUNCTION__._ZN6SoLoud6Soloud26updateVoiceVolume_internalEj = external hidden unnamed_addr constant [62 x i8], align 1

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

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN6SoLoud6Soloud26updateVoiceVolume_internalEj(ptr nocapture noundef nonnull readonly align 8 dereferenceable(138833) %0, i32 noundef %1) local_unnamed_addr #1 align 2 {
  %3 = icmp ult i32 %1, 1024
  br i1 %3, label %5, label %4

4:                                                ; preds = %2
  tail call void @__assert_fail(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 150, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN6SoLoud6Soloud26updateVoiceVolume_internalEj) #2
  unreachable

5:                                                ; preds = %2
  %6 = getelementptr inbounds i8, ptr %0, i64 16
  %7 = load i8, ptr %6, align 8, !tbaa !5, !range !16, !noundef !17
  %8 = trunc nuw i8 %7 to i1
  br i1 %8, label %10, label %9

9:                                                ; preds = %5
  tail call void @__assert_fail(ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.1, i32 noundef 151, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN6SoLoud6Soloud26updateVoiceVolume_internalEj) #2
  unreachable

10:                                               ; preds = %5
  %11 = getelementptr inbounds i8, ptr %0, i64 152
  %12 = zext nneg i32 %1 to i64
  %13 = getelementptr inbounds [1024 x ptr], ptr %11, i64 0, i64 %12
  %14 = load ptr, ptr %13, align 8, !tbaa !18
  %15 = getelementptr inbounds i8, ptr %14, i64 56
  %16 = load float, ptr %15, align 8, !tbaa !19
  %17 = getelementptr inbounds i8, ptr %0, i64 11840
  %18 = getelementptr inbounds [1024 x %"class.SoLoud::AudioSourceInstance3dData"], ptr %17, i64 0, i64 %12, i32 12
  %19 = load float, ptr %18, align 8, !tbaa !21
  %20 = fmul float %16, %19
  %21 = getelementptr inbounds i8, ptr %14, i64 60
  store float %20, ptr %21, align 4, !tbaa !23
  %22 = getelementptr inbounds i8, ptr %14, i64 16
  %23 = load i32, ptr %22, align 8, !tbaa !24
  %24 = and i32 %23, 4
  %.not = icmp eq i32 %24, 0
  br i1 %.not, label %.loopexit, label %.preheader

.preheader:                                       ; preds = %10
  %25 = getelementptr inbounds i8, ptr %14, i64 24
  %26 = getelementptr inbounds i8, ptr %14, i64 348
  %27 = load <4 x float>, ptr %25, align 4, !tbaa !25
  %28 = insertelement <4 x float> poison, float %20, i64 0
  %29 = shufflevector <4 x float> %28, <4 x float> poison, <4 x i32> zeroinitializer
  %30 = fmul <4 x float> %27, %29
  store <4 x float> %30, ptr %26, align 4, !tbaa !25
  %31 = getelementptr inbounds i8, ptr %14, i64 40
  %32 = getelementptr inbounds i8, ptr %14, i64 364
  %33 = load <4 x float>, ptr %31, align 4, !tbaa !25
  %34 = fmul <4 x float> %33, %29
  store <4 x float> %34, ptr %32, align 4, !tbaa !25
  br label %.loopexit

.loopexit:                                        ; preds = %.preheader, %10
  ret void
}

attributes #0 = { 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 #1 = { 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 #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, !10, i64 16}
!6 = !{!"_ZTSN6SoLoud6SoloudE", !7, i64 0, !7, i64 8, !10, i64 16, !7, i64 24, !7, i64 32, !7, i64 40, !11, i64 48, !11, i64 52, !12, i64 56, !11, i64 80, !12, i64 88, !7, i64 112, !12, i64 120, !7, i64 144, !8, i64 152, !11, i64 8344, !11, i64 8348, !11, i64 8352, !11, i64 8356, !7, i64 8360, !11, i64 8368, !11, i64 8372, !13, i64 8376, !13, i64 8380, !11, i64 8384, !11, i64 8388, !14, i64 8392, !15, i64 8440, !15, i64 8448, !8, i64 8456, !8, i64 8520, !8, i64 8584, !8, i64 8616, !8, i64 9640, !8, i64 10664, !8, i64 11688, !8, i64 11700, !8, i64 11712, !8, i64 11724, !13, i64 11736, !8, i64 11740, !8, i64 11840, !7, i64 134720, !11, i64 134728, !8, i64 134732, !11, i64 138828, !10, i64 138832}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"bool", !8, i64 0}
!11 = !{!"int", !8, i64 0}
!12 = !{!"_ZTSN6SoLoud18AlignedFloatBufferE", !7, i64 0, !7, i64 8, !11, i64 16}
!13 = !{!"float", !8, i64 0}
!14 = !{!"_ZTSN6SoLoud5FaderE", !13, i64 0, !13, i64 4, !13, i64 8, !15, i64 16, !15, i64 24, !15, i64 32, !13, i64 40, !11, i64 44}
!15 = !{!"double", !8, i64 0}
!16 = !{i8 0, i8 2}
!17 = !{}
!18 = !{!7, !7, i64 0}
!19 = !{!20, !13, i64 56}
!20 = !{!"_ZTSN6SoLoud19AudioSourceInstanceE", !11, i64 8, !11, i64 12, !11, i64 16, !13, i64 20, !8, i64 24, !13, i64 56, !13, i64 60, !13, i64 64, !13, i64 68, !11, i64 72, !13, i64 76, !13, i64 80, !15, i64 88, !15, i64 96, !14, i64 104, !14, i64 152, !14, i64 200, !14, i64 248, !14, i64 296, !11, i64 344, !8, i64 348, !11, i64 380, !11, i64 384, !8, i64 392, !8, i64 456, !11, i64 472, !11, i64 476, !11, i64 480, !15, i64 488}
!21 = !{!22, !13, i64 72}
!22 = !{!"_ZTSN6SoLoud25AudioSourceInstance3dDataE", !8, i64 0, !8, i64 12, !13, i64 24, !13, i64 28, !13, i64 32, !11, i64 36, !13, i64 40, !7, i64 48, !7, i64 56, !11, i64 64, !13, i64 68, !13, i64 72, !8, i64 76, !11, i64 108, !11, i64 112}
!23 = !{!20, !13, i64 60}
!24 = !{!20, !11, i64 16}
!25 = !{!13, !13, i64 0}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,LICMPass,LoopRotatePass,LoopSimplifyPass,PostOrderFunctionAttrsPass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass