; LLVM IR from merpheus-dev/LavaEngine :: src/Utils/soloud/src/core (soloud_audiosource)

; 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::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::AudioSource" = type { ptr, i32, float, float, i32, i32, float, float, float, i32, float, [8 x ptr], ptr, ptr, ptr, i32, double }

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN6SoLoud19AudioSourceInstance4initERNS_11AudioSourceEi(ptr noundef nonnull align 8 dereferenceable(496) %0, ptr noundef nonnull align 8 dereferenceable(152) %1, i32 noundef %2) #0 align 2 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store i32 %2, ptr %6, align 4, !tbaa !9
  %7 = load ptr, ptr %4, align 8
  %8 = load i32, ptr %6, align 4, !tbaa !9
  %9 = getelementptr inbounds %"class.SoLoud::AudioSourceInstance", ptr %7, i32 0, i32 1
  store i32 %8, ptr %9, align 8, !tbaa !11
  %10 = load ptr, ptr %5, align 8, !tbaa !5
  %11 = getelementptr inbounds %"class.SoLoud::AudioSource", ptr %10, i32 0, i32 2
  %12 = load float, ptr %11, align 4, !tbaa !16
  %13 = getelementptr inbounds %"class.SoLoud::AudioSourceInstance", ptr %7, i32 0, i32 8
  store float %12, ptr %13, align 8, !tbaa !18
  %14 = getelementptr inbounds %"class.SoLoud::AudioSourceInstance", ptr %7, i32 0, i32 8
  %15 = load float, ptr %14, align 8, !tbaa !18
  %16 = getelementptr inbounds %"class.SoLoud::AudioSourceInstance", ptr %7, i32 0, i32 9
  store float %15, ptr %16, align 4, !tbaa !19
  %17 = load ptr, ptr %5, align 8, !tbaa !5
  %18 = getelementptr inbounds %"class.SoLoud::AudioSource", ptr %17, i32 0, i32 4
  %19 = load i32, ptr %18, align 4, !tbaa !20
  %20 = getelementptr inbounds %"class.SoLoud::AudioSourceInstance", ptr %7, i32 0, i32 10
  store i32 %19, ptr %20, align 8, !tbaa !21
  %21 = getelementptr inbounds %"class.SoLoud::AudioSourceInstance", ptr %7, i32 0, i32 13
  store double 0.000000e+00, ptr %21, align 8, !tbaa !22
  %22 = getelementptr inbounds %"class.SoLoud::AudioSourceInstance", ptr %7, i32 0, i32 14
  store double 0.000000e+00, ptr %22, align 8, !tbaa !23
  %23 = load ptr, ptr %5, align 8, !tbaa !5
  %24 = getelementptr inbounds %"class.SoLoud::AudioSource", ptr %23, i32 0, i32 16
  %25 = load double, ptr %24, align 8, !tbaa !24
  %26 = getelementptr inbounds %"class.SoLoud::AudioSourceInstance", ptr %7, i32 0, i32 29
  store double %25, ptr %26, align 8, !tbaa !25
  %27 = load ptr, ptr %5, align 8, !tbaa !5
  %28 = getelementptr inbounds %"class.SoLoud::AudioSource", ptr %27, i32 0, i32 1
  %29 = load i32, ptr %28, align 8, !tbaa !26
  %30 = and i32 %29, 1
  %31 = icmp ne i32 %30, 0
  br i1 %31, label %32, label %36

32:                                               ; preds = %3
  %33 = getelementptr inbounds %"class.SoLoud::AudioSourceInstance", ptr %7, i32 0, i32 3
  %34 = load i32, ptr %33, align 8, !tbaa !27
  %35 = or i32 %34, 1
  store i32 %35, ptr %33, align 8, !tbaa !27
  br label %36

36:                                               ; preds = %32, %3
  %37 = load ptr, ptr %5, align 8, !tbaa !5
  %38 = getelementptr inbounds %"class.SoLoud::AudioSource", ptr %37, i32 0, i32 1
  %39 = load i32, ptr %38, align 8, !tbaa !26
  %40 = and i32 %39, 8
  %41 = icmp ne i32 %40, 0
  br i1 %41, label %42, label %46

42:                                               ; preds = %36
  %43 = getelementptr inbounds %"class.SoLoud::AudioSourceInstance", ptr %7, i32 0, i32 3
  %44 = load i32, ptr %43, align 8, !tbaa !27
  %45 = or i32 %44, 8
  store i32 %45, ptr %43, align 8, !tbaa !27
  br label %46

46:                                               ; preds = %42, %36
  %47 = load ptr, ptr %5, align 8, !tbaa !5
  %48 = getelementptr inbounds %"class.SoLoud::AudioSource", ptr %47, i32 0, i32 1
  %49 = load i32, ptr %48, align 8, !tbaa !26
  %50 = and i32 %49, 16
  %51 = icmp ne i32 %50, 0
  br i1 %51, label %52, label %56

52:                                               ; preds = %46
  %53 = getelementptr inbounds %"class.SoLoud::AudioSourceInstance", ptr %7, i32 0, i32 3
  %54 = load i32, ptr %53, align 8, !tbaa !27
  %55 = or i32 %54, 16
  store i32 %55, ptr %53, align 8, !tbaa !27
  br label %56

56:                                               ; preds = %52, %46
  %57 = load ptr, ptr %5, align 8, !tbaa !5
  %58 = getelementptr inbounds %"class.SoLoud::AudioSource", ptr %57, i32 0, i32 1
  %59 = load i32, ptr %58, align 8, !tbaa !26
  %60 = and i32 %59, 64
  %61 = icmp ne i32 %60, 0
  br i1 %61, label %62, label %66

62:                                               ; preds = %56
  %63 = getelementptr inbounds %"class.SoLoud::AudioSourceInstance", ptr %7, i32 0, i32 3
  %64 = load i32, ptr %63, align 8, !tbaa !27
  %65 = or i32 %64, 64
  store i32 %65, ptr %63, align 8, !tbaa !27
  br label %66

66:                                               ; preds = %62, %56
  %67 = load ptr, ptr %5, align 8, !tbaa !5
  %68 = getelementptr inbounds %"class.SoLoud::AudioSource", ptr %67, i32 0, i32 1
  %69 = load i32, ptr %68, align 8, !tbaa !26
  %70 = and i32 %69, 128
  %71 = icmp ne i32 %70, 0
  br i1 %71, label %72, label %76

72:                                               ; preds = %66
  %73 = getelementptr inbounds %"class.SoLoud::AudioSourceInstance", ptr %7, i32 0, i32 3
  %74 = load i32, ptr %73, align 8, !tbaa !27
  %75 = or i32 %74, 128
  store i32 %75, ptr %73, align 8, !tbaa !27
  br label %76

76:                                               ; preds = %72, %66
  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" }

!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, !10, i64 8}
!12 = !{!"_ZTSN6SoLoud19AudioSourceInstanceE", !10, i64 8, !10, i64 12, !10, i64 16, !13, i64 20, !7, i64 24, !13, i64 56, !13, i64 60, !13, i64 64, !13, i64 68, !10, i64 72, !13, i64 76, !13, i64 80, !14, i64 88, !14, i64 96, !15, i64 104, !15, i64 152, !15, i64 200, !15, i64 248, !15, 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, !14, i64 488}
!13 = !{!"float", !7, i64 0}
!14 = !{!"double", !7, i64 0}
!15 = !{!"_ZTSN6SoLoud5FaderE", !13, i64 0, !13, i64 4, !13, i64 8, !14, i64 16, !14, i64 24, !14, i64 32, !13, i64 40, !10, i64 44}
!16 = !{!17, !13, i64 12}
!17 = !{!"_ZTSN6SoLoud11AudioSourceE", !10, i64 8, !13, i64 12, !13, i64 16, !10, i64 20, !10, i64 24, !13, i64 28, !13, i64 32, !13, i64 36, !10, i64 40, !13, i64 44, !7, i64 48, !6, i64 112, !6, i64 120, !6, i64 128, !10, i64 136, !14, i64 144}
!18 = !{!12, !13, i64 64}
!19 = !{!12, !13, i64 68}
!20 = !{!17, !10, i64 20}
!21 = !{!12, !10, i64 72}
!22 = !{!12, !14, i64 88}
!23 = !{!12, !14, i64 96}
!24 = !{!17, !14, i64 144}
!25 = !{!12, !14, i64 488}
!26 = !{!17, !10, i64 8}
!27 = !{!12, !10, i64 16}


; 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 nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local void @_ZN6SoLoud19AudioSourceInstance4initERNS_11AudioSourceEi(ptr nocapture noundef nonnull align 8 dereferenceable(496) %0, ptr nocapture noundef nonnull readonly align 8 dereferenceable(152) %1, i32 noundef %2) local_unnamed_addr #0 align 2 {
  %4 = getelementptr inbounds i8, ptr %0, i64 8
  store i32 %2, ptr %4, align 8, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %1, i64 12
  %6 = load float, ptr %5, align 4, !tbaa !13
  %7 = getelementptr inbounds i8, ptr %0, i64 64
  store float %6, ptr %7, align 8, !tbaa !16
  %8 = getelementptr inbounds i8, ptr %0, i64 68
  store float %6, ptr %8, align 4, !tbaa !17
  %9 = getelementptr inbounds i8, ptr %1, i64 20
  %10 = load i32, ptr %9, align 4, !tbaa !18
  %11 = getelementptr inbounds i8, ptr %0, i64 72
  store i32 %10, ptr %11, align 8, !tbaa !19
  %12 = getelementptr inbounds i8, ptr %0, i64 88
  %13 = getelementptr inbounds i8, ptr %1, i64 144
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %12, i8 0, i64 16, i1 false)
  %14 = load double, ptr %13, align 8, !tbaa !20
  %15 = getelementptr inbounds i8, ptr %0, i64 488
  store double %14, ptr %15, align 8, !tbaa !21
  %16 = getelementptr inbounds i8, ptr %1, i64 8
  %17 = load i32, ptr %16, align 8, !tbaa !22
  %18 = and i32 %17, 1
  %.not = icmp eq i32 %18, 0
  br i1 %.not, label %23, label %19

19:                                               ; preds = %3
  %20 = getelementptr inbounds i8, ptr %0, i64 16
  %21 = load i32, ptr %20, align 8, !tbaa !23
  %22 = or i32 %21, 1
  store i32 %22, ptr %20, align 8, !tbaa !23
  br label %23

23:                                               ; preds = %19, %3
  %24 = and i32 %17, 8
  %.not9 = icmp eq i32 %24, 0
  br i1 %.not9, label %29, label %25

25:                                               ; preds = %23
  %26 = getelementptr inbounds i8, ptr %0, i64 16
  %27 = load i32, ptr %26, align 8, !tbaa !23
  %28 = or i32 %27, 8
  store i32 %28, ptr %26, align 8, !tbaa !23
  br label %29

29:                                               ; preds = %25, %23
  %30 = and i32 %17, 16
  %.not10 = icmp eq i32 %30, 0
  br i1 %.not10, label %35, label %31

31:                                               ; preds = %29
  %32 = getelementptr inbounds i8, ptr %0, i64 16
  %33 = load i32, ptr %32, align 8, !tbaa !23
  %34 = or i32 %33, 16
  store i32 %34, ptr %32, align 8, !tbaa !23
  br label %35

35:                                               ; preds = %31, %29
  %36 = and i32 %17, 64
  %.not11 = icmp eq i32 %36, 0
  br i1 %.not11, label %41, label %37

37:                                               ; preds = %35
  %38 = getelementptr inbounds i8, ptr %0, i64 16
  %39 = load i32, ptr %38, align 8, !tbaa !23
  %40 = or i32 %39, 64
  store i32 %40, ptr %38, align 8, !tbaa !23
  br label %41

41:                                               ; preds = %37, %35
  %42 = and i32 %17, 128
  %.not12 = icmp eq i32 %42, 0
  br i1 %.not12, label %47, label %43

43:                                               ; preds = %41
  %44 = getelementptr inbounds i8, ptr %0, i64 16
  %45 = load i32, ptr %44, align 8, !tbaa !23
  %46 = or i32 %45, 128
  store i32 %46, ptr %44, align 8, !tbaa !23
  br label %47

47:                                               ; preds = %43, %41
  ret void
}

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

attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) 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 = { nocallback nofree nounwind willreturn memory(argmem: write) }

!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 8}
!6 = !{!"_ZTSN6SoLoud19AudioSourceInstanceE", !7, i64 8, !7, i64 12, !7, i64 16, !10, i64 20, !8, i64 24, !10, i64 56, !10, i64 60, !10, i64 64, !10, i64 68, !7, i64 72, !10, i64 76, !10, i64 80, !11, i64 88, !11, i64 96, !12, i64 104, !12, i64 152, !12, i64 200, !12, i64 248, !12, i64 296, !7, i64 344, !8, i64 348, !7, i64 380, !7, i64 384, !8, i64 392, !8, i64 456, !7, i64 472, !7, i64 476, !7, i64 480, !11, i64 488}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"float", !8, i64 0}
!11 = !{!"double", !8, i64 0}
!12 = !{!"_ZTSN6SoLoud5FaderE", !10, i64 0, !10, i64 4, !10, i64 8, !11, i64 16, !11, i64 24, !11, i64 32, !10, i64 40, !7, i64 44}
!13 = !{!14, !10, i64 12}
!14 = !{!"_ZTSN6SoLoud11AudioSourceE", !7, i64 8, !10, i64 12, !10, i64 16, !7, i64 20, !7, i64 24, !10, i64 28, !10, i64 32, !10, i64 36, !7, i64 40, !10, i64 44, !8, i64 48, !15, i64 112, !15, i64 120, !15, i64 128, !7, i64 136, !11, i64 144}
!15 = !{!"any pointer", !8, i64 0}
!16 = !{!6, !10, i64 64}
!17 = !{!6, !10, i64 68}
!18 = !{!14, !7, i64 20}
!19 = !{!6, !7, i64 72}
!20 = !{!14, !11, i64 144}
!21 = !{!6, !11, i64 488}
!22 = !{!14, !7, i64 8}
!23 = !{!6, !7, i64 16}


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