; LLVM IR from Overload-Technologies/Overload :: Dependencies/soloud/src/audiosource/noise (soloud_noise)

; 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::NoiseInstance" = type <{ %"class.SoLoud::AudioSourceInstance", [10 x float], %"class.SoLoud::Misc::Prg", [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 }
%"class.SoLoud::Fader" = type { float, float, float, double, double, double, float, i32 }
%"class.SoLoud::Misc::Prg" = type { [16 x i32], i32 }
%"class.SoLoud::Noise" = type { %"class.SoLoud::AudioSource", [10 x float] }
%"class.SoLoud::AudioSource" = type { ptr, i32, float, float, i32, i32, float, float, float, i32, float, [8 x ptr], ptr, ptr, ptr, i32, double }

@_ZTVN6SoLoud13NoiseInstanceE = external dso_local unnamed_addr constant { [9 x ptr] }, align 8

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN6SoLoud13NoiseInstanceC2EPNS_5NoiseE(ptr noundef nonnull align 8 dereferenceable(604) %0, ptr noundef %1) unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %8 = load ptr, ptr %3, align 8
  call void @_ZN6SoLoud19AudioSourceInstanceC2Ev(ptr noundef nonnull align 8 dereferenceable(496) %8)
  store ptr getelementptr inbounds inrange(-16, 56) ({ [9 x ptr] }, ptr @_ZTVN6SoLoud13NoiseInstanceE, i32 0, i32 0, i32 2), ptr %8, align 8, !tbaa !9
  %9 = getelementptr inbounds %"class.SoLoud::NoiseInstance", ptr %8, i32 0, i32 2
  invoke void @_ZN6SoLoud4Misc3PrgC1Ev(ptr noundef nonnull align 4 dereferenceable(68) %9)
          to label %10 unwind label %15

10:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  store i32 0, ptr %7, align 4, !tbaa !11
  br label %11

11:                                               ; preds = %30, %10
  %12 = load i32, ptr %7, align 4, !tbaa !11
  %13 = icmp slt i32 %12, 10
  br i1 %13, label %19, label %14

14:                                               ; preds = %11
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  br label %33

15:                                               ; preds = %33, %2
  %16 = landingpad { ptr, i32 }
          cleanup
  %17 = extractvalue { ptr, i32 } %16, 0
  store ptr %17, ptr %5, align 8
  %18 = extractvalue { ptr, i32 } %16, 1
  store i32 %18, ptr %6, align 4
  call void @_ZN6SoLoud19AudioSourceInstanceD2Ev(ptr noundef nonnull align 8 dereferenceable(496) %8) #4
  br label %36

19:                                               ; preds = %11
  %20 = load ptr, ptr %4, align 8, !tbaa !5
  %21 = getelementptr inbounds %"class.SoLoud::Noise", ptr %20, i32 0, i32 1
  %22 = load i32, ptr %7, align 4, !tbaa !11
  %23 = sext i32 %22 to i64
  %24 = getelementptr inbounds [10 x float], ptr %21, i64 0, i64 %23
  %25 = load float, ptr %24, align 4, !tbaa !13
  %26 = getelementptr inbounds %"class.SoLoud::NoiseInstance", ptr %8, i32 0, i32 1
  %27 = load i32, ptr %7, align 4, !tbaa !11
  %28 = sext i32 %27 to i64
  %29 = getelementptr inbounds [10 x float], ptr %26, i64 0, i64 %28
  store float %25, ptr %29, align 4, !tbaa !13
  br label %30

30:                                               ; preds = %19
  %31 = load i32, ptr %7, align 4, !tbaa !11
  %32 = add nsw i32 %31, 1
  store i32 %32, ptr %7, align 4, !tbaa !11
  br label %11, !llvm.loop !15

33:                                               ; preds = %14
  %34 = getelementptr inbounds %"class.SoLoud::NoiseInstance", ptr %8, i32 0, i32 2
  invoke void @_ZN6SoLoud4Misc3Prg5srandEi(ptr noundef nonnull align 4 dereferenceable(68) %34, i32 noundef 64222)
          to label %35 unwind label %15

35:                                               ; preds = %33
  ret void

36:                                               ; preds = %15
  %37 = load ptr, ptr %5, align 8
  %38 = load i32, ptr %6, align 4
  %39 = insertvalue { ptr, i32 } poison, ptr %37, 0
  %40 = insertvalue { ptr, i32 } %39, i32 %38, 1
  resume { ptr, i32 } %40
}

declare void @_ZN6SoLoud19AudioSourceInstanceC2Ev(ptr noundef nonnull align 8 dereferenceable(496)) unnamed_addr #1

declare void @_ZN6SoLoud4Misc3PrgC1Ev(ptr noundef nonnull align 4 dereferenceable(68)) unnamed_addr #1

declare i32 @__gxx_personality_v0(...)

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

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

declare void @_ZN6SoLoud4Misc3Prg5srandEi(ptr noundef nonnull align 4 dereferenceable(68), i32 noundef) #1

; Function Attrs: nounwind
declare void @_ZN6SoLoud19AudioSourceInstanceD2Ev(ptr noundef nonnull align 8 dereferenceable(496)) unnamed_addr #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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #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 = !{!"vtable pointer", !8, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"float", !7, i64 0}
!15 = distinct !{!15, !16}
!16 = !{!"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"

@_ZTVN6SoLoud13NoiseInstanceE = external dso_local unnamed_addr constant { [9 x ptr] }, align 8

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN6SoLoud13NoiseInstanceC2EPNS_5NoiseE(ptr noundef nonnull align 8 dereferenceable(604) %0, ptr nocapture noundef readonly %1) unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  tail call void @_ZN6SoLoud19AudioSourceInstanceC2Ev(ptr noundef nonnull align 8 dereferenceable(496) %0)
  store ptr getelementptr inbounds inrange(-16, 56) (i8, ptr @_ZTVN6SoLoud13NoiseInstanceE, i64 16), ptr %0, align 8, !tbaa !5
  %3 = getelementptr inbounds i8, ptr %0, i64 536
  invoke void @_ZN6SoLoud4Misc3PrgC1Ev(ptr noundef nonnull align 4 dereferenceable(68) %3)
          to label %.preheader unwind label %34

.preheader:                                       ; preds = %2
  %4 = getelementptr inbounds i8, ptr %1, i64 152
  %5 = getelementptr inbounds i8, ptr %0, i64 496
  %6 = load float, ptr %4, align 4, !tbaa !8
  store float %6, ptr %5, align 8, !tbaa !8
  %7 = getelementptr inbounds i8, ptr %1, i64 156
  %8 = load float, ptr %7, align 4, !tbaa !8
  %9 = getelementptr inbounds i8, ptr %0, i64 500
  store float %8, ptr %9, align 4, !tbaa !8
  %10 = getelementptr inbounds i8, ptr %1, i64 160
  %11 = load float, ptr %10, align 4, !tbaa !8
  %12 = getelementptr inbounds i8, ptr %0, i64 504
  store float %11, ptr %12, align 8, !tbaa !8
  %13 = getelementptr inbounds i8, ptr %1, i64 164
  %14 = load float, ptr %13, align 4, !tbaa !8
  %15 = getelementptr inbounds i8, ptr %0, i64 508
  store float %14, ptr %15, align 4, !tbaa !8
  %16 = getelementptr inbounds i8, ptr %1, i64 168
  %17 = load float, ptr %16, align 4, !tbaa !8
  %18 = getelementptr inbounds i8, ptr %0, i64 512
  store float %17, ptr %18, align 8, !tbaa !8
  %19 = getelementptr inbounds i8, ptr %1, i64 172
  %20 = load float, ptr %19, align 4, !tbaa !8
  %21 = getelementptr inbounds i8, ptr %0, i64 516
  store float %20, ptr %21, align 4, !tbaa !8
  %22 = getelementptr inbounds i8, ptr %1, i64 176
  %23 = load float, ptr %22, align 4, !tbaa !8
  %24 = getelementptr inbounds i8, ptr %0, i64 520
  store float %23, ptr %24, align 8, !tbaa !8
  %25 = getelementptr inbounds i8, ptr %1, i64 180
  %26 = load float, ptr %25, align 4, !tbaa !8
  %27 = getelementptr inbounds i8, ptr %0, i64 524
  store float %26, ptr %27, align 4, !tbaa !8
  %28 = getelementptr inbounds i8, ptr %1, i64 184
  %29 = load float, ptr %28, align 4, !tbaa !8
  %30 = getelementptr inbounds i8, ptr %0, i64 528
  store float %29, ptr %30, align 8, !tbaa !8
  %31 = getelementptr inbounds i8, ptr %1, i64 188
  %32 = load float, ptr %31, align 4, !tbaa !8
  %33 = getelementptr inbounds i8, ptr %0, i64 532
  store float %32, ptr %33, align 4, !tbaa !8
  invoke void @_ZN6SoLoud4Misc3Prg5srandEi(ptr noundef nonnull align 4 dereferenceable(68) %3, i32 noundef 64222)
          to label %36 unwind label %34

34:                                               ; preds = %.preheader, %2
  %35 = landingpad { ptr, i32 }
          cleanup
  tail call void @_ZN6SoLoud19AudioSourceInstanceD2Ev(ptr noundef nonnull align 8 dereferenceable(496) %0) #3
  resume { ptr, i32 } %35

36:                                               ; preds = %.preheader
  ret void
}

declare void @_ZN6SoLoud19AudioSourceInstanceC2Ev(ptr noundef nonnull align 8 dereferenceable(496)) unnamed_addr #1

declare void @_ZN6SoLoud4Misc3PrgC1Ev(ptr noundef nonnull align 4 dereferenceable(68)) unnamed_addr #1

declare i32 @__gxx_personality_v0(...)

declare void @_ZN6SoLoud4Misc3Prg5srandEi(ptr noundef nonnull align 4 dereferenceable(68), i32 noundef) local_unnamed_addr #1

; Function Attrs: nounwind
declare void @_ZN6SoLoud19AudioSourceInstanceD2Ev(ptr noundef nonnull align 8 dereferenceable(496)) unnamed_addr #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 = { 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 = { 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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"float", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}


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