; LLVM IR from mvr/jiggle :: src (Particle)

; 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.jgVector2 = type { float, float }
%struct.jgParticle = type { float, %struct.jgVector2, %struct.jgVector2, %struct.jgVector2, %struct.jgVector2, %struct.jgVector2, float, float, i8, i8, ptr }

; 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: nounwind uwtable
define dso_local ptr @jgParticleInit(ptr noundef %0, float noundef %1, <2 x float> %2) #1 {
  %4 = alloca %struct.jgVector2, align 4
  %5 = alloca ptr, align 8
  %6 = alloca float, align 4
  %7 = alloca %struct.jgVector2, align 4
  %8 = alloca %struct.jgVector2, align 4
  %9 = alloca %struct.jgVector2, align 4
  store <2 x float> %2, ptr %4, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store float %1, ptr %6, align 4, !tbaa !9
  %10 = load float, ptr %6, align 4, !tbaa !9
  %11 = load ptr, ptr %5, align 8, !tbaa !5
  %12 = getelementptr inbounds %struct.jgParticle, ptr %11, i32 0, i32 0
  store float %10, ptr %12, align 8, !tbaa !11
  %13 = load ptr, ptr %5, align 8, !tbaa !5
  %14 = getelementptr inbounds %struct.jgParticle, ptr %13, i32 0, i32 1
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %14, ptr align 4 %4, i64 8, i1 false), !tbaa.struct !15
  %15 = load ptr, ptr %5, align 8, !tbaa !5
  %16 = getelementptr inbounds %struct.jgParticle, ptr %15, i32 0, i32 2
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %16, ptr align 4 %4, i64 8, i1 false), !tbaa.struct !15
  %17 = load ptr, ptr %5, align 8, !tbaa !5
  %18 = getelementptr inbounds %struct.jgParticle, ptr %17, i32 0, i32 3
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  %19 = call <2 x float> @jgVector2Zero()
  store <2 x float> %19, ptr %7, align 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %18, ptr align 4 %7, i64 8, i1 false), !tbaa.struct !15
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  %20 = load ptr, ptr %5, align 8, !tbaa !5
  %21 = getelementptr inbounds %struct.jgParticle, ptr %20, i32 0, i32 4
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  %22 = call <2 x float> @jgVector2Zero()
  store <2 x float> %22, ptr %8, align 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %21, ptr align 4 %8, i64 8, i1 false), !tbaa.struct !15
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  %23 = load ptr, ptr %5, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct.jgParticle, ptr %23, i32 0, i32 5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  %25 = call <2 x float> @jgVector2Zero()
  store <2 x float> %25, ptr %9, align 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %24, ptr align 4 %9, i64 8, i1 false), !tbaa.struct !15
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  %26 = load ptr, ptr %5, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.jgParticle, ptr %26, i32 0, i32 6
  store float 0x3FE99999A0000000, ptr %27, align 4, !tbaa !16
  %28 = load ptr, ptr %5, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.jgParticle, ptr %28, i32 0, i32 7
  store float 0x3FD3333340000000, ptr %29, align 8, !tbaa !17
  %30 = load ptr, ptr %5, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.jgParticle, ptr %30, i32 0, i32 8
  store i8 1, ptr %31, align 4, !tbaa !18
  %32 = load ptr, ptr %5, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.jgParticle, ptr %32, i32 0, i32 9
  store i8 0, ptr %33, align 1, !tbaa !19
  %34 = load ptr, ptr %5, align 8, !tbaa !5
  ret ptr %34
}

; 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) #2

; Function Attrs: inlinehint nounwind uwtable
declare hidden <2 x float> @jgVector2Zero() #3

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nounwind uwtable "min-legal-vector-width"="64" "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 nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { inlinehint nounwind uwtable "min-legal-vector-width"="64" "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/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"float", !7, i64 0}
!11 = !{!12, !10, i64 0}
!12 = !{!"jgParticle", !10, i64 0, !13, i64 4, !13, i64 12, !13, i64 20, !13, i64 28, !13, i64 36, !10, i64 44, !10, i64 48, !14, i64 52, !14, i64 53, !6, i64 56}
!13 = !{!"jgVector2", !10, i64 0, !10, i64 4}
!14 = !{!"_Bool", !7, i64 0}
!15 = !{i64 0, i64 4, !9, i64 4, i64 4, !9}
!16 = !{!12, !10, i64 44}
!17 = !{!12, !10, i64 48}
!18 = !{!12, !14, i64 52}
!19 = !{!12, !14, i64 53}


; 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: nounwind uwtable
define dso_local noundef ptr @jgParticleInit(ptr noundef returned writeonly %0, float noundef %1, <2 x float> %2) local_unnamed_addr #0 {
  store float %1, ptr %0, align 8, !tbaa !5
  %4 = getelementptr inbounds i8, ptr %0, i64 4
  store <2 x float> %2, ptr %4, align 4
  %5 = getelementptr inbounds i8, ptr %0, i64 12
  store <2 x float> %2, ptr %5, align 4
  %6 = getelementptr inbounds i8, ptr %0, i64 20
  %7 = tail call <2 x float> @jgVector2Zero()
  store <2 x float> %7, ptr %6, align 4
  %8 = getelementptr inbounds i8, ptr %0, i64 28
  %9 = tail call <2 x float> @jgVector2Zero()
  store <2 x float> %9, ptr %8, align 4
  %10 = getelementptr inbounds i8, ptr %0, i64 36
  %11 = tail call <2 x float> @jgVector2Zero()
  store <2 x float> %11, ptr %10, align 4
  %12 = getelementptr inbounds i8, ptr %0, i64 44
  store <2 x float> <float 0x3FE99999A0000000, float 0x3FD3333340000000>, ptr %12, align 4, !tbaa !13
  %13 = getelementptr inbounds i8, ptr %0, i64 52
  store i8 1, ptr %13, align 4, !tbaa !14
  %14 = getelementptr inbounds i8, ptr %0, i64 53
  store i8 0, ptr %14, align 1, !tbaa !15
  ret ptr %0
}

; Function Attrs: inlinehint nounwind uwtable
declare hidden <2 x float> @jgVector2Zero() local_unnamed_addr #1

attributes #0 = { nounwind uwtable "min-legal-vector-width"="64" "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 = { inlinehint nounwind uwtable "min-legal-vector-width"="64" "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, !7, i64 0}
!6 = !{!"jgParticle", !7, i64 0, !10, i64 4, !10, i64 12, !10, i64 20, !10, i64 28, !10, i64 36, !7, i64 44, !7, i64 48, !11, i64 52, !11, i64 53, !12, i64 56}
!7 = !{!"float", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"jgVector2", !7, i64 0, !7, i64 4}
!11 = !{!"_Bool", !8, i64 0}
!12 = !{!"any pointer", !8, i64 0}
!13 = !{!7, !7, i64 0}
!14 = !{!6, !11, i64 52}
!15 = !{!6, !11, i64 53}


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