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

; 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] }>

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN6SoLoud6Soloud21set3dSourceParametersEjffffff(ptr noundef nonnull align 8 dereferenceable(138833) %0, i32 noundef %1, float noundef %2, float noundef %3, float noundef %4, float noundef %5, float noundef %6, float noundef %7) #1 align 2 {
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca float, align 4
  %12 = alloca float, align 4
  %13 = alloca float, align 4
  %14 = alloca float, align 4
  %15 = alloca float, align 4
  %16 = alloca float, align 4
  %17 = alloca ptr, align 8
  %18 = alloca [2 x i32], align 4
  %19 = alloca i32, align 4
  store ptr %0, ptr %9, align 8, !tbaa !5
  store i32 %1, ptr %10, align 4, !tbaa !9
  store float %2, ptr %11, align 4, !tbaa !11
  store float %3, ptr %12, align 4, !tbaa !11
  store float %4, ptr %13, align 4, !tbaa !11
  store float %5, ptr %14, align 4, !tbaa !11
  store float %6, ptr %15, align 4, !tbaa !11
  store float %7, ptr %16, align 4, !tbaa !11
  %20 = load ptr, ptr %9, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #3
  store ptr null, ptr %17, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #3
  %21 = load i32, ptr %10, align 4, !tbaa !9
  store i32 %21, ptr %18, align 4, !tbaa !9
  %22 = getelementptr inbounds i32, ptr %18, i64 1
  store i32 0, ptr %22, align 4, !tbaa !9
  %23 = load i32, ptr %10, align 4, !tbaa !9
  %24 = call noundef ptr @_ZNK6SoLoud6Soloud32voiceGroupHandleToArray_internalEj(ptr noundef nonnull align 8 dereferenceable(138833) %20, i32 noundef %23)
  store ptr %24, ptr %17, align 8, !tbaa !5
  %25 = load ptr, ptr %17, align 8, !tbaa !5
  %26 = icmp eq ptr %25, null
  br i1 %26, label %27, label %29

27:                                               ; preds = %8
  %28 = getelementptr inbounds [2 x i32], ptr %18, i64 0, i64 0
  store ptr %28, ptr %17, align 8, !tbaa !5
  br label %29

29:                                               ; preds = %27, %8
  br label %30

30:                                               ; preds = %94, %29
  %31 = load ptr, ptr %17, align 8, !tbaa !5
  %32 = load i32, ptr %31, align 4, !tbaa !9
  %33 = icmp ne i32 %32, 0
  br i1 %33, label %34, label %97

34:                                               ; preds = %30
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #3
  %35 = load ptr, ptr %17, align 8, !tbaa !5
  %36 = load i32, ptr %35, align 4, !tbaa !9
  %37 = and i32 %36, 4095
  %38 = sub i32 %37, 1
  store i32 %38, ptr %19, align 4, !tbaa !9
  %39 = load i32, ptr %19, align 4, !tbaa !9
  %40 = icmp ne i32 %39, -1
  br i1 %40, label %41, label %94

41:                                               ; preds = %34
  %42 = getelementptr inbounds %"class.SoLoud::Soloud", ptr %20, i32 0, i32 44
  %43 = load i32, ptr %19, align 4, !tbaa !9
  %44 = sext i32 %43 to i64
  %45 = getelementptr inbounds [1024 x %"class.SoLoud::AudioSourceInstance3dData"], ptr %42, i64 0, i64 %44
  %46 = getelementptr inbounds %"class.SoLoud::AudioSourceInstance3dData", ptr %45, i32 0, i32 15
  %47 = load i32, ptr %46, align 8, !tbaa !13
  %48 = load ptr, ptr %17, align 8, !tbaa !5
  %49 = load i32, ptr %48, align 4, !tbaa !9
  %50 = icmp eq i32 %47, %49
  br i1 %50, label %51, label %94

51:                                               ; preds = %41
  %52 = load float, ptr %11, align 4, !tbaa !11
  %53 = getelementptr inbounds %"class.SoLoud::Soloud", ptr %20, i32 0, i32 44
  %54 = load i32, ptr %19, align 4, !tbaa !9
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds [1024 x %"class.SoLoud::AudioSourceInstance3dData"], ptr %53, i64 0, i64 %55
  %57 = getelementptr inbounds %"class.SoLoud::AudioSourceInstance3dData", ptr %56, i32 0, i32 0
  %58 = getelementptr inbounds [3 x float], ptr %57, i64 0, i64 0
  store float %52, ptr %58, align 8, !tbaa !11
  %59 = load float, ptr %12, align 4, !tbaa !11
  %60 = getelementptr inbounds %"class.SoLoud::Soloud", ptr %20, i32 0, i32 44
  %61 = load i32, ptr %19, align 4, !tbaa !9
  %62 = sext i32 %61 to i64
  %63 = getelementptr inbounds [1024 x %"class.SoLoud::AudioSourceInstance3dData"], ptr %60, i64 0, i64 %62
  %64 = getelementptr inbounds %"class.SoLoud::AudioSourceInstance3dData", ptr %63, i32 0, i32 0
  %65 = getelementptr inbounds [3 x float], ptr %64, i64 0, i64 1
  store float %59, ptr %65, align 4, !tbaa !11
  %66 = load float, ptr %13, align 4, !tbaa !11
  %67 = getelementptr inbounds %"class.SoLoud::Soloud", ptr %20, i32 0, i32 44
  %68 = load i32, ptr %19, align 4, !tbaa !9
  %69 = sext i32 %68 to i64
  %70 = getelementptr inbounds [1024 x %"class.SoLoud::AudioSourceInstance3dData"], ptr %67, i64 0, i64 %69
  %71 = getelementptr inbounds %"class.SoLoud::AudioSourceInstance3dData", ptr %70, i32 0, i32 0
  %72 = getelementptr inbounds [3 x float], ptr %71, i64 0, i64 2
  store float %66, ptr %72, align 8, !tbaa !11
  %73 = load float, ptr %14, align 4, !tbaa !11
  %74 = getelementptr inbounds %"class.SoLoud::Soloud", ptr %20, i32 0, i32 44
  %75 = load i32, ptr %19, align 4, !tbaa !9
  %76 = sext i32 %75 to i64
  %77 = getelementptr inbounds [1024 x %"class.SoLoud::AudioSourceInstance3dData"], ptr %74, i64 0, i64 %76
  %78 = getelementptr inbounds %"class.SoLoud::AudioSourceInstance3dData", ptr %77, i32 0, i32 1
  %79 = getelementptr inbounds [3 x float], ptr %78, i64 0, i64 0
  store float %73, ptr %79, align 4, !tbaa !11
  %80 = load float, ptr %15, align 4, !tbaa !11
  %81 = getelementptr inbounds %"class.SoLoud::Soloud", ptr %20, i32 0, i32 44
  %82 = load i32, ptr %19, align 4, !tbaa !9
  %83 = sext i32 %82 to i64
  %84 = getelementptr inbounds [1024 x %"class.SoLoud::AudioSourceInstance3dData"], ptr %81, i64 0, i64 %83
  %85 = getelementptr inbounds %"class.SoLoud::AudioSourceInstance3dData", ptr %84, i32 0, i32 1
  %86 = getelementptr inbounds [3 x float], ptr %85, i64 0, i64 1
  store float %80, ptr %86, align 4, !tbaa !11
  %87 = load float, ptr %16, align 4, !tbaa !11
  %88 = getelementptr inbounds %"class.SoLoud::Soloud", ptr %20, i32 0, i32 44
  %89 = load i32, ptr %19, align 4, !tbaa !9
  %90 = sext i32 %89 to i64
  %91 = getelementptr inbounds [1024 x %"class.SoLoud::AudioSourceInstance3dData"], ptr %88, i64 0, i64 %90
  %92 = getelementptr inbounds %"class.SoLoud::AudioSourceInstance3dData", ptr %91, i32 0, i32 1
  %93 = getelementptr inbounds [3 x float], ptr %92, i64 0, i64 2
  store float %87, ptr %93, align 4, !tbaa !11
  br label %94

94:                                               ; preds = %51, %41, %34
  %95 = load ptr, ptr %17, align 8, !tbaa !5
  %96 = getelementptr inbounds i32, ptr %95, i32 1
  store ptr %96, ptr %17, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #3
  br label %30, !llvm.loop !15

97:                                               ; preds = %30
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #3
  ret void
}

declare noundef ptr @_ZNK6SoLoud6Soloud32voiceGroupHandleToArray_internalEj(ptr noundef nonnull align 8 dereferenceable(138833), i32 noundef) #2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { "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 = !{!"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, !12, i64 0}
!12 = !{!"float", !7, i64 0}
!13 = !{!14, !10, i64 112}
!14 = !{!"_ZTSN6SoLoud25AudioSourceInstance3dDataE", !7, i64 0, !7, i64 12, !12, i64 24, !12, i64 28, !12, i64 32, !10, i64 36, !12, i64 40, !6, i64 48, !6, i64 56, !10, i64 64, !12, i64 68, !12, i64 72, !7, i64 76, !10, i64 108, !10, i64 112}
!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"

%"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] }>

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN6SoLoud6Soloud21set3dSourceParametersEjffffff(ptr noundef nonnull align 8 dereferenceable(138833) %0, i32 noundef %1, float noundef %2, float noundef %3, float noundef %4, float noundef %5, float noundef %6, float noundef %7) local_unnamed_addr #1 align 2 {
  %9 = alloca [2 x i32], align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #3
  store i32 %1, ptr %9, align 4, !tbaa !5
  %10 = getelementptr inbounds i8, ptr %9, i64 4
  store i32 0, ptr %10, align 4, !tbaa !5
  %11 = tail call noundef ptr @_ZNK6SoLoud6Soloud32voiceGroupHandleToArray_internalEj(ptr noundef nonnull align 8 dereferenceable(138833) %0, i32 noundef %1)
  %12 = icmp eq ptr %11, null
  %spec.select = select i1 %12, ptr %9, ptr %11
  %13 = load i32, ptr %spec.select, align 4, !tbaa !5
  %.not25 = icmp eq i32 %13, 0
  br i1 %.not25, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %8
  %14 = getelementptr inbounds i8, ptr %0, i64 11840
  br label %15

15:                                               ; preds = %.lr.ph, %31
  %16 = phi i32 [ %13, %.lr.ph ], [ %33, %31 ]
  %.126 = phi ptr [ %spec.select, %.lr.ph ], [ %32, %31 ]
  %17 = and i32 %16, 4095
  %.not24 = icmp eq i32 %17, 0
  br i1 %.not24, label %31, label %18

18:                                               ; preds = %15
  %19 = add nsw i32 %17, -1
  %20 = zext nneg i32 %19 to i64
  %21 = getelementptr inbounds [1024 x %"class.SoLoud::AudioSourceInstance3dData"], ptr %14, i64 0, i64 %20
  %22 = getelementptr inbounds i8, ptr %21, i64 112
  %23 = load i32, ptr %22, align 8, !tbaa !9
  %24 = icmp eq i32 %23, %16
  br i1 %24, label %25, label %31

25:                                               ; preds = %18
  store float %2, ptr %21, align 8, !tbaa !13
  %26 = getelementptr inbounds i8, ptr %21, i64 4
  store float %3, ptr %26, align 4, !tbaa !13
  %27 = getelementptr inbounds i8, ptr %21, i64 8
  store float %4, ptr %27, align 8, !tbaa !13
  %28 = getelementptr inbounds i8, ptr %21, i64 12
  store float %5, ptr %28, align 4, !tbaa !13
  %29 = getelementptr inbounds i8, ptr %21, i64 16
  store float %6, ptr %29, align 8, !tbaa !13
  %30 = getelementptr inbounds i8, ptr %21, i64 20
  store float %7, ptr %30, align 4, !tbaa !13
  br label %31

31:                                               ; preds = %25, %18, %15
  %32 = getelementptr inbounds i8, ptr %.126, i64 4
  %33 = load i32, ptr %32, align 4, !tbaa !5
  %.not = icmp eq i32 %33, 0
  br i1 %.not, label %._crit_edge, label %15, !llvm.loop !14

._crit_edge:                                      ; preds = %31, %8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #3
  ret void
}

declare noundef ptr @_ZNK6SoLoud6Soloud32voiceGroupHandleToArray_internalEj(ptr noundef nonnull align 8 dereferenceable(138833), i32 noundef) local_unnamed_addr #2

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { "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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !6, i64 112}
!10 = !{!"_ZTSN6SoLoud25AudioSourceInstance3dDataE", !7, i64 0, !7, i64 12, !11, i64 24, !11, i64 28, !11, i64 32, !6, i64 36, !11, i64 40, !12, i64 48, !12, i64 56, !6, i64 64, !11, i64 68, !11, i64 72, !7, i64 76, !6, i64 108, !6, i64 112}
!11 = !{!"float", !7, i64 0}
!12 = !{!"any pointer", !7, i64 0}
!13 = !{!11, !11, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass