; LLVM IR from zig-gamedev/zphysics :: libs/JoltC (JoltPhysicsC)

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

%struct.JPC_BodyCreationSettings = type { [4 x float], [4 x float], [4 x float], [4 x float], i64, i16, %struct.JPC_CollisionGroup, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, float, float, float, float, float, float, float, i32, i32, i8, float, [8 x i8], %struct.JPC_MassProperties, ptr, ptr }
%struct.JPC_CollisionGroup = type { ptr, i32, i32 }
%struct.JPC_MassProperties = type { float, [12 x i8], [16 x float] }

@.str.1 = external hidden unnamed_addr constant [82 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [99 x i8], align 1
@__PRETTY_FUNCTION__.JPC_BodyCreationSettings_Set = external hidden unnamed_addr constant [147 x i8], align 1

; 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: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #1

; Function Attrs: mustprogress uwtable
declare dso_local void @JPC_BodyCreationSettings_SetDefault(ptr noundef) #2

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #3

; Function Attrs: mustprogress uwtable
define dso_local void @JPC_BodyCreationSettings_Set(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, i8 noundef zeroext %4, i16 noundef zeroext %5) #2 {
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i8, align 1
  %12 = alloca i16, align 2
  %13 = alloca %struct.JPC_BodyCreationSettings, align 16
  store ptr %0, ptr %7, align 8, !tbaa !5
  store ptr %1, ptr %8, align 8, !tbaa !5
  store ptr %2, ptr %9, align 8, !tbaa !5
  store ptr %3, ptr %10, align 8, !tbaa !5
  store i8 %4, ptr %11, align 1, !tbaa !9
  store i16 %5, ptr %12, align 2, !tbaa !10
  %14 = load ptr, ptr %7, align 8, !tbaa !5
  %15 = icmp ne ptr %14, null
  br i1 %15, label %16, label %25

16:                                               ; preds = %6
  %17 = load ptr, ptr %8, align 8, !tbaa !5
  %18 = icmp ne ptr %17, null
  br i1 %18, label %19, label %25

19:                                               ; preds = %16
  %20 = load ptr, ptr %9, align 8, !tbaa !5
  %21 = icmp ne ptr %20, null
  br i1 %21, label %22, label %25

22:                                               ; preds = %19
  %23 = load ptr, ptr %10, align 8, !tbaa !5
  %24 = icmp ne ptr %23, null
  br label %25

25:                                               ; preds = %22, %19, %16, %6
  %26 = phi i1 [ false, %19 ], [ false, %16 ], [ false, %6 ], [ %24, %22 ]
  br i1 %26, label %27, label %28

27:                                               ; preds = %25
  br label %30

28:                                               ; preds = %25
  call void @__assert_fail(ptr noundef @.str.4, ptr noundef @.str.1, i32 noundef 601, ptr noundef @__PRETTY_FUNCTION__.JPC_BodyCreationSettings_Set) #4
  unreachable

29:                                               ; No predecessors!
  br label %30

30:                                               ; preds = %29, %27
  call void @llvm.lifetime.start.p0(i64 256, ptr %13) #5
  call void @JPC_BodyCreationSettings_SetDefault(ptr noundef %13)
  %31 = load ptr, ptr %9, align 8, !tbaa !5
  %32 = getelementptr inbounds float, ptr %31, i64 0
  %33 = load float, ptr %32, align 4, !tbaa !12
  %34 = getelementptr inbounds %struct.JPC_BodyCreationSettings, ptr %13, i32 0, i32 0
  %35 = getelementptr inbounds [4 x float], ptr %34, i64 0, i64 0
  store float %33, ptr %35, align 16, !tbaa !12
  %36 = load ptr, ptr %9, align 8, !tbaa !5
  %37 = getelementptr inbounds float, ptr %36, i64 1
  %38 = load float, ptr %37, align 4, !tbaa !12
  %39 = getelementptr inbounds %struct.JPC_BodyCreationSettings, ptr %13, i32 0, i32 0
  %40 = getelementptr inbounds [4 x float], ptr %39, i64 0, i64 1
  store float %38, ptr %40, align 4, !tbaa !12
  %41 = load ptr, ptr %9, align 8, !tbaa !5
  %42 = getelementptr inbounds float, ptr %41, i64 2
  %43 = load float, ptr %42, align 4, !tbaa !12
  %44 = getelementptr inbounds %struct.JPC_BodyCreationSettings, ptr %13, i32 0, i32 0
  %45 = getelementptr inbounds [4 x float], ptr %44, i64 0, i64 2
  store float %43, ptr %45, align 8, !tbaa !12
  %46 = load ptr, ptr %10, align 8, !tbaa !5
  %47 = getelementptr inbounds float, ptr %46, i64 0
  %48 = load float, ptr %47, align 4, !tbaa !12
  %49 = getelementptr inbounds %struct.JPC_BodyCreationSettings, ptr %13, i32 0, i32 1
  %50 = getelementptr inbounds [4 x float], ptr %49, i64 0, i64 0
  store float %48, ptr %50, align 16, !tbaa !12
  %51 = load ptr, ptr %10, align 8, !tbaa !5
  %52 = getelementptr inbounds float, ptr %51, i64 1
  %53 = load float, ptr %52, align 4, !tbaa !12
  %54 = getelementptr inbounds %struct.JPC_BodyCreationSettings, ptr %13, i32 0, i32 1
  %55 = getelementptr inbounds [4 x float], ptr %54, i64 0, i64 1
  store float %53, ptr %55, align 4, !tbaa !12
  %56 = load ptr, ptr %10, align 8, !tbaa !5
  %57 = getelementptr inbounds float, ptr %56, i64 2
  %58 = load float, ptr %57, align 4, !tbaa !12
  %59 = getelementptr inbounds %struct.JPC_BodyCreationSettings, ptr %13, i32 0, i32 1
  %60 = getelementptr inbounds [4 x float], ptr %59, i64 0, i64 2
  store float %58, ptr %60, align 8, !tbaa !12
  %61 = load ptr, ptr %10, align 8, !tbaa !5
  %62 = getelementptr inbounds float, ptr %61, i64 3
  %63 = load float, ptr %62, align 4, !tbaa !12
  %64 = getelementptr inbounds %struct.JPC_BodyCreationSettings, ptr %13, i32 0, i32 1
  %65 = getelementptr inbounds [4 x float], ptr %64, i64 0, i64 3
  store float %63, ptr %65, align 4, !tbaa !12
  %66 = load i16, ptr %12, align 2, !tbaa !10
  %67 = getelementptr inbounds %struct.JPC_BodyCreationSettings, ptr %13, i32 0, i32 5
  store i16 %66, ptr %67, align 8, !tbaa !14
  %68 = load i8, ptr %11, align 1, !tbaa !9
  %69 = getelementptr inbounds %struct.JPC_BodyCreationSettings, ptr %13, i32 0, i32 7
  store i8 %68, ptr %69, align 16, !tbaa !21
  %70 = load ptr, ptr %8, align 8, !tbaa !5
  %71 = getelementptr inbounds %struct.JPC_BodyCreationSettings, ptr %13, i32 0, i32 31
  store ptr %70, ptr %71, align 8, !tbaa !22
  %72 = load ptr, ptr %7, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %72, ptr align 16 %13, i64 256, i1 false), !tbaa.struct !23
  call void @llvm.lifetime.end.p0(i64 256, ptr %13) #5
  ret void
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 #3 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { noreturn nounwind }
attributes #5 = { 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 = !{!7, !7, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"short", !7, i64 0}
!12 = !{!13, !13, i64 0}
!13 = !{!"float", !7, i64 0}
!14 = !{!15, !11, i64 72}
!15 = !{!"_ZTS24JPC_BodyCreationSettings", !7, i64 0, !7, i64 16, !7, i64 32, !7, i64 48, !16, i64 64, !11, i64 72, !17, i64 80, !7, i64 96, !7, i64 97, !19, i64 98, !19, i64 99, !19, i64 100, !19, i64 101, !19, i64 102, !7, i64 103, !19, i64 104, !19, i64 105, !13, i64 108, !13, i64 112, !13, i64 116, !13, i64 120, !13, i64 124, !13, i64 128, !13, i64 132, !18, i64 136, !18, i64 140, !7, i64 144, !13, i64 148, !20, i64 160, !6, i64 240, !6, i64 248}
!16 = !{!"long", !7, i64 0}
!17 = !{!"_ZTS18JPC_CollisionGroup", !6, i64 0, !18, i64 8, !18, i64 12}
!18 = !{!"int", !7, i64 0}
!19 = !{!"bool", !7, i64 0}
!20 = !{!"_ZTS18JPC_MassProperties", !13, i64 0, !7, i64 16}
!21 = !{!15, !7, i64 96}
!22 = !{!15, !6, i64 248}
!23 = !{i64 0, i64 16, !9, i64 16, i64 16, !9, i64 32, i64 16, !9, i64 48, i64 16, !9, i64 64, i64 8, !24, i64 72, i64 2, !10, i64 80, i64 8, !5, i64 88, i64 4, !25, i64 92, i64 4, !25, i64 96, i64 1, !9, i64 97, i64 1, !9, i64 98, i64 1, !26, i64 99, i64 1, !26, i64 100, i64 1, !26, i64 101, i64 1, !26, i64 102, i64 1, !26, i64 103, i64 1, !9, i64 104, i64 1, !26, i64 105, i64 1, !26, i64 108, i64 4, !12, i64 112, i64 4, !12, i64 116, i64 4, !12, i64 120, i64 4, !12, i64 124, i64 4, !12, i64 128, i64 4, !12, i64 132, i64 4, !12, i64 136, i64 4, !25, i64 140, i64 4, !25, i64 144, i64 1, !9, i64 148, i64 4, !12, i64 160, i64 4, !12, i64 176, i64 64, !9, i64 240, i64 8, !5, i64 248, i64 8, !5}
!24 = !{!16, !16, i64 0}
!25 = !{!18, !18, i64 0}
!26 = !{!19, !19, i64 0}


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

%struct.JPC_BodyCreationSettings = type { [4 x float], [4 x float], [4 x float], [4 x float], i64, i16, %struct.JPC_CollisionGroup, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, float, float, float, float, float, float, float, i32, i32, i8, float, [8 x i8], %struct.JPC_MassProperties, ptr, ptr }
%struct.JPC_CollisionGroup = type { ptr, i32, i32 }
%struct.JPC_MassProperties = type { float, [12 x i8], [16 x float] }

@.str.1 = external hidden unnamed_addr constant [82 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [99 x i8], align 1
@__PRETTY_FUNCTION__.JPC_BodyCreationSettings_Set = external hidden unnamed_addr constant [147 x i8], align 1

; 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: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare dso_local void @JPC_BodyCreationSettings_SetDefault(ptr noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #3

; Function Attrs: mustprogress uwtable
define dso_local void @JPC_BodyCreationSettings_Set(ptr noundef writeonly %0, ptr noundef %1, ptr noundef readonly %2, ptr noundef readonly %3, i8 noundef zeroext %4, i16 noundef zeroext %5) local_unnamed_addr #2 {
  %7 = alloca %struct.JPC_BodyCreationSettings, align 16
  %8 = insertelement <4 x ptr> poison, ptr %0, i64 0
  %9 = insertelement <4 x ptr> %8, ptr %1, i64 1
  %10 = insertelement <4 x ptr> %9, ptr %2, i64 2
  %11 = insertelement <4 x ptr> %10, ptr %3, i64 3
  %12 = icmp eq <4 x ptr> %11, zeroinitializer
  %13 = bitcast <4 x i1> %12 to i4
  %14 = icmp eq i4 %13, 0
  br i1 %14, label %15, label %.critedge

.critedge:                                        ; preds = %6
  tail call void @__assert_fail(ptr noundef nonnull @.str.4, ptr noundef nonnull @.str.1, i32 noundef 601, ptr noundef nonnull @__PRETTY_FUNCTION__.JPC_BodyCreationSettings_Set) #4
  unreachable

15:                                               ; preds = %6
  call void @llvm.lifetime.start.p0(i64 256, ptr nonnull %7) #5
  call void @JPC_BodyCreationSettings_SetDefault(ptr noundef nonnull %7)
  %16 = load <2 x float>, ptr %2, align 4, !tbaa !5
  store <2 x float> %16, ptr %7, align 16, !tbaa !5
  %17 = getelementptr inbounds i8, ptr %2, i64 8
  %18 = load float, ptr %17, align 4, !tbaa !5
  %19 = getelementptr inbounds i8, ptr %7, i64 8
  store float %18, ptr %19, align 8, !tbaa !5
  %20 = getelementptr inbounds i8, ptr %7, i64 16
  %21 = load <4 x float>, ptr %3, align 4, !tbaa !5
  store <4 x float> %21, ptr %20, align 16, !tbaa !5
  %22 = getelementptr inbounds i8, ptr %7, i64 72
  store i16 %5, ptr %22, align 8, !tbaa !9
  %23 = getelementptr inbounds i8, ptr %7, i64 96
  store i8 %4, ptr %23, align 16, !tbaa !18
  %24 = getelementptr inbounds i8, ptr %7, i64 248
  store ptr %1, ptr %24, align 8, !tbaa !19
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(256) %0, ptr noundef nonnull align 16 dereferenceable(256) %7, i64 256, i1 false), !tbaa.struct !20
  call void @llvm.lifetime.end.p0(i64 256, ptr nonnull %7) #5
  ret void
}

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 #3 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { noreturn nounwind }
attributes #5 = { 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 = !{!"float", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !12, i64 72}
!10 = !{!"_ZTS24JPC_BodyCreationSettings", !7, i64 0, !7, i64 16, !7, i64 32, !7, i64 48, !11, i64 64, !12, i64 72, !13, i64 80, !7, i64 96, !7, i64 97, !16, i64 98, !16, i64 99, !16, i64 100, !16, i64 101, !16, i64 102, !7, i64 103, !16, i64 104, !16, i64 105, !6, i64 108, !6, i64 112, !6, i64 116, !6, i64 120, !6, i64 124, !6, i64 128, !6, i64 132, !15, i64 136, !15, i64 140, !7, i64 144, !6, i64 148, !17, i64 160, !14, i64 240, !14, i64 248}
!11 = !{!"long", !7, i64 0}
!12 = !{!"short", !7, i64 0}
!13 = !{!"_ZTS18JPC_CollisionGroup", !14, i64 0, !15, i64 8, !15, i64 12}
!14 = !{!"any pointer", !7, i64 0}
!15 = !{!"int", !7, i64 0}
!16 = !{!"bool", !7, i64 0}
!17 = !{!"_ZTS18JPC_MassProperties", !6, i64 0, !7, i64 16}
!18 = !{!10, !7, i64 96}
!19 = !{!10, !14, i64 248}
!20 = !{i64 0, i64 16, !21, i64 16, i64 16, !21, i64 32, i64 16, !21, i64 48, i64 16, !21, i64 64, i64 8, !22, i64 72, i64 2, !23, i64 80, i64 8, !24, i64 88, i64 4, !25, i64 92, i64 4, !25, i64 96, i64 1, !21, i64 97, i64 1, !21, i64 98, i64 1, !26, i64 99, i64 1, !26, i64 100, i64 1, !26, i64 101, i64 1, !26, i64 102, i64 1, !26, i64 103, i64 1, !21, i64 104, i64 1, !26, i64 105, i64 1, !26, i64 108, i64 4, !5, i64 112, i64 4, !5, i64 116, i64 4, !5, i64 120, i64 4, !5, i64 124, i64 4, !5, i64 128, i64 4, !5, i64 132, i64 4, !5, i64 136, i64 4, !25, i64 140, i64 4, !25, i64 144, i64 1, !21, i64 148, i64 4, !5, i64 160, i64 4, !5, i64 176, i64 64, !21, i64 240, i64 8, !24, i64 248, i64 8, !24}
!21 = !{!7, !7, i64 0}
!22 = !{!11, !11, i64 0}
!23 = !{!12, !12, i64 0}
!24 = !{!14, !14, i64 0}
!25 = !{!15, !15, i64 0}
!26 = !{!16, !16, i64 0}


; Effective O3 passes: EarlyCSEPass,GlobalDCEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass