; LLVM IR from Mithreindeir/VelocityRaptor :: VelocityRaptor/src (vrParticle)

; 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.vrVec2 = type { float, float }
%struct.vrColor = type { float, float, float }
%struct.vrParticle = type { %struct.vrVec2, %struct.vrVec2, %struct.vrVec2, %struct.vrVec2, %struct.vrVec2, float, float, float, float, float, float, float, %struct.vrColor }

; Function Attrs: nounwind uwtable
define dso_local ptr @vrParticleInit(ptr noundef %0, <2 x float> %1) #0 {
  %3 = alloca %struct.vrVec2, align 4
  %4 = alloca ptr, align 8
  %5 = alloca %struct.vrVec2, align 4
  %6 = alloca %struct.vrVec2, align 4
  %7 = alloca %struct.vrVec2, align 4
  %8 = alloca %struct.vrColor, align 4
  %9 = alloca { <2 x float>, float }, align 8
  store <2 x float> %1, ptr %3, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  %10 = load ptr, ptr %4, align 8, !tbaa !5
  %11 = getelementptr inbounds %struct.vrParticle, ptr %10, i32 0, i32 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %11, ptr align 4 %3, i64 8, i1 false), !tbaa.struct !9
  %12 = load ptr, ptr %4, align 8, !tbaa !5
  %13 = getelementptr inbounds %struct.vrParticle, ptr %12, i32 0, i32 1
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %13, ptr align 4 %3, i64 8, i1 false), !tbaa.struct !9
  %14 = load ptr, ptr %4, align 8, !tbaa !5
  %15 = getelementptr inbounds %struct.vrParticle, ptr %14, i32 0, i32 2
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #4
  %16 = call <2 x float> @vrVect(float noundef 0.000000e+00, float noundef 0.000000e+00)
  store <2 x float> %16, ptr %5, align 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %15, ptr align 4 %5, i64 8, i1 false), !tbaa.struct !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #4
  %17 = load ptr, ptr %4, align 8, !tbaa !5
  %18 = getelementptr inbounds %struct.vrParticle, ptr %17, i32 0, i32 3
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #4
  %19 = call <2 x float> @vrVect(float noundef 0.000000e+00, float noundef 0.000000e+00)
  store <2 x float> %19, ptr %6, align 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %18, ptr align 4 %6, i64 8, i1 false), !tbaa.struct !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  %20 = load ptr, ptr %4, align 8, !tbaa !5
  %21 = getelementptr inbounds %struct.vrParticle, ptr %20, i32 0, i32 4
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  %22 = call <2 x float> @vrVect(float noundef 0.000000e+00, float noundef 0.000000e+00)
  store <2 x float> %22, ptr %7, align 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %21, ptr align 4 %7, i64 8, i1 false), !tbaa.struct !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  %23 = load ptr, ptr %4, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct.vrParticle, ptr %23, i32 0, i32 5
  store float 1.000000e+00, ptr %24, align 4, !tbaa !12
  %25 = load ptr, ptr %4, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.vrParticle, ptr %25, i32 0, i32 6
  store float 0.000000e+00, ptr %26, align 4, !tbaa !16
  %27 = load ptr, ptr %4, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.vrParticle, ptr %27, i32 0, i32 8
  store float 0x3FD3333340000000, ptr %28, align 4, !tbaa !17
  %29 = load ptr, ptr %4, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.vrParticle, ptr %29, i32 0, i32 7
  store float 0x3FE99999A0000000, ptr %30, align 4, !tbaa !18
  %31 = load ptr, ptr %4, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.vrParticle, ptr %31, i32 0, i32 12
  call void @llvm.lifetime.start.p0(i64 12, ptr %8) #4
  %33 = call { <2 x float>, float } @vrColorCreate(float noundef 0.000000e+00, float noundef 5.000000e-01, float noundef 1.000000e+00)
  store { <2 x float>, float } %33, ptr %9, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %8, ptr align 8 %9, i64 12, i1 false)
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %32, ptr align 4 %8, i64 12, i1 false), !tbaa.struct !19
  call void @llvm.lifetime.end.p0(i64 12, ptr %8) #4
  %34 = load ptr, ptr %4, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct.vrParticle, ptr %34, i32 0, i32 9
  store float 2.000000e+00, ptr %35, align 4, !tbaa !20
  %36 = load ptr, ptr %4, align 8, !tbaa !5
  ret ptr %36
}

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

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

declare <2 x float> @vrVect(float noundef, float noundef) #3

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

declare { <2 x float>, float } @vrColorCreate(float noundef, float noundef, float noundef) #3

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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { "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 = !{i64 0, i64 4, !10, i64 4, i64 4, !10}
!10 = !{!11, !11, i64 0}
!11 = !{!"float", !7, i64 0}
!12 = !{!13, !11, i64 40}
!13 = !{!"vrParticle", !14, i64 0, !14, i64 8, !14, i64 16, !14, i64 24, !14, i64 32, !11, i64 40, !11, i64 44, !11, i64 48, !11, i64 52, !11, i64 56, !11, i64 60, !11, i64 64, !15, i64 68}
!14 = !{!"vrVec2", !11, i64 0, !11, i64 4}
!15 = !{!"vrColor", !11, i64 0, !11, i64 4, !11, i64 8}
!16 = !{!13, !11, i64 44}
!17 = !{!13, !11, i64 52}
!18 = !{!13, !11, i64 48}
!19 = !{i64 0, i64 4, !10, i64 4, i64 4, !10, i64 8, i64 4, !10}
!20 = !{!13, !11, i64 56}


; 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 @vrParticleInit(ptr noundef returned writeonly %0, <2 x float> %1) local_unnamed_addr #0 {
  store <2 x float> %1, ptr %0, align 4
  %3 = getelementptr inbounds i8, ptr %0, i64 8
  store <2 x float> %1, ptr %3, align 4
  %4 = getelementptr inbounds i8, ptr %0, i64 16
  %5 = tail call <2 x float> @vrVect(float noundef 0.000000e+00, float noundef 0.000000e+00) #2
  store <2 x float> %5, ptr %4, align 4
  %6 = getelementptr inbounds i8, ptr %0, i64 24
  %7 = tail call <2 x float> @vrVect(float noundef 0.000000e+00, float noundef 0.000000e+00) #2
  store <2 x float> %7, ptr %6, align 4
  %8 = getelementptr inbounds i8, ptr %0, i64 32
  %9 = tail call <2 x float> @vrVect(float noundef 0.000000e+00, float noundef 0.000000e+00) #2
  store <2 x float> %9, ptr %8, align 4
  %10 = getelementptr inbounds i8, ptr %0, i64 40
  store <4 x float> <float 1.000000e+00, float 0.000000e+00, float 0x3FE99999A0000000, float 0x3FD3333340000000>, ptr %10, align 4, !tbaa !5
  %11 = getelementptr inbounds i8, ptr %0, i64 68
  %12 = tail call { <2 x float>, float } @vrColorCreate(float noundef 0.000000e+00, float noundef 5.000000e-01, float noundef 1.000000e+00) #2
  %.fca.0.extract = extractvalue { <2 x float>, float } %12, 0
  %.fca.1.extract = extractvalue { <2 x float>, float } %12, 1
  store <2 x float> %.fca.0.extract, ptr %11, align 4
  %.sroa.4.0..sroa_idx = getelementptr inbounds i8, ptr %0, i64 76
  store float %.fca.1.extract, ptr %.sroa.4.0..sroa_idx, align 4, !tbaa !5
  %13 = getelementptr inbounds i8, ptr %0, i64 56
  store float 2.000000e+00, ptr %13, align 4, !tbaa !9
  ret ptr %0
}

declare <2 x float> @vrVect(float noundef, float noundef) local_unnamed_addr #1

declare { <2 x float>, float } @vrColorCreate(float noundef, float noundef, float noundef) 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 = { "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 }

!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/C++ TBAA"}
!9 = !{!10, !6, i64 56}
!10 = !{!"vrParticle", !11, i64 0, !11, i64 8, !11, i64 16, !11, i64 24, !11, i64 32, !6, i64 40, !6, i64 44, !6, i64 48, !6, i64 52, !6, i64 56, !6, i64 60, !6, i64 64, !12, i64 68}
!11 = !{!"vrVec2", !6, i64 0, !6, i64 4}
!12 = !{!"vrColor", !6, i64 0, !6, i64 4, !6, i64 8}


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