; LLVM IR from vokegpu/bicudo :: src/util/math.ll (ZN6bicudo23splash_edges_normalizedEPNS_4vec2ES1_)

; 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.bicudo::vec2" = type { %union.anon }
%union.anon = type { %struct.anon }
%struct.anon = type { float, float }

; 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 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.end.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN6bicudo23splash_edges_normalizedEPNS_4vec2ES1_(ptr noundef %0, ptr noundef %1) #2 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca %"struct.bicudo::vec2", align 4
  %6 = alloca %"struct.bicudo::vec2", align 4
  %7 = alloca %"struct.bicudo::vec2", align 4
  %8 = alloca %"struct.bicudo::vec2", align 4
  %9 = alloca %"struct.bicudo::vec2", align 4
  %10 = alloca %"struct.bicudo::vec2", align 4
  %11 = alloca %"struct.bicudo::vec2", align 4
  %12 = alloca %"struct.bicudo::vec2", align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #4
  %13 = load ptr, ptr %4, align 8, !tbaa !5
  %14 = getelementptr inbounds %"struct.bicudo::vec2", ptr %13, i64 1
  %15 = load ptr, ptr %4, align 8, !tbaa !5
  %16 = getelementptr inbounds %"struct.bicudo::vec2", ptr %15, i64 2
  %17 = call <2 x float> @_ZN6bicudo4vec2miERKS0_(ptr noundef nonnull align 4 dereferenceable(8) %14, ptr noundef nonnull align 4 dereferenceable(8) %16)
  %18 = getelementptr inbounds %"struct.bicudo::vec2", ptr %6, i32 0, i32 0
  %19 = getelementptr inbounds %union.anon, ptr %18, i32 0, i32 0
  store <2 x float> %17, ptr %19, align 4
  %20 = call <2 x float> @_ZN6bicudo4vec29normalizeEv(ptr noundef nonnull align 4 dereferenceable(8) %6)
  %21 = getelementptr inbounds %"struct.bicudo::vec2", ptr %5, i32 0, i32 0
  %22 = getelementptr inbounds %union.anon, ptr %21, i32 0, i32 0
  store <2 x float> %20, ptr %22, align 4
  %23 = load ptr, ptr %3, align 8, !tbaa !5
  %24 = getelementptr inbounds %"struct.bicudo::vec2", ptr %23, i64 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %24, ptr align 4 %5, i64 8, i1 false), !tbaa.struct !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  %25 = load ptr, ptr %4, align 8, !tbaa !5
  %26 = getelementptr inbounds %"struct.bicudo::vec2", ptr %25, i64 2
  %27 = load ptr, ptr %4, align 8, !tbaa !5
  %28 = getelementptr inbounds %"struct.bicudo::vec2", ptr %27, i64 3
  %29 = call <2 x float> @_ZN6bicudo4vec2miERKS0_(ptr noundef nonnull align 4 dereferenceable(8) %26, ptr noundef nonnull align 4 dereferenceable(8) %28)
  %30 = getelementptr inbounds %"struct.bicudo::vec2", ptr %8, i32 0, i32 0
  %31 = getelementptr inbounds %union.anon, ptr %30, i32 0, i32 0
  store <2 x float> %29, ptr %31, align 4
  %32 = call <2 x float> @_ZN6bicudo4vec29normalizeEv(ptr noundef nonnull align 4 dereferenceable(8) %8)
  %33 = getelementptr inbounds %"struct.bicudo::vec2", ptr %7, i32 0, i32 0
  %34 = getelementptr inbounds %union.anon, ptr %33, i32 0, i32 0
  store <2 x float> %32, ptr %34, align 4
  %35 = load ptr, ptr %3, align 8, !tbaa !5
  %36 = getelementptr inbounds %"struct.bicudo::vec2", ptr %35, i64 1
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %36, ptr align 4 %7, i64 8, i1 false), !tbaa.struct !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #4
  %37 = load ptr, ptr %4, align 8, !tbaa !5
  %38 = getelementptr inbounds %"struct.bicudo::vec2", ptr %37, i64 3
  %39 = load ptr, ptr %4, align 8, !tbaa !5
  %40 = getelementptr inbounds %"struct.bicudo::vec2", ptr %39, i64 0
  %41 = call <2 x float> @_ZN6bicudo4vec2miERKS0_(ptr noundef nonnull align 4 dereferenceable(8) %38, ptr noundef nonnull align 4 dereferenceable(8) %40)
  %42 = getelementptr inbounds %"struct.bicudo::vec2", ptr %10, i32 0, i32 0
  %43 = getelementptr inbounds %union.anon, ptr %42, i32 0, i32 0
  store <2 x float> %41, ptr %43, align 4
  %44 = call <2 x float> @_ZN6bicudo4vec29normalizeEv(ptr noundef nonnull align 4 dereferenceable(8) %10)
  %45 = getelementptr inbounds %"struct.bicudo::vec2", ptr %9, i32 0, i32 0
  %46 = getelementptr inbounds %union.anon, ptr %45, i32 0, i32 0
  store <2 x float> %44, ptr %46, align 4
  %47 = load ptr, ptr %3, align 8, !tbaa !5
  %48 = getelementptr inbounds %"struct.bicudo::vec2", ptr %47, i64 2
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %48, ptr align 4 %9, i64 8, i1 false), !tbaa.struct !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #4
  %49 = load ptr, ptr %4, align 8, !tbaa !5
  %50 = getelementptr inbounds %"struct.bicudo::vec2", ptr %49, i64 0
  %51 = load ptr, ptr %4, align 8, !tbaa !5
  %52 = getelementptr inbounds %"struct.bicudo::vec2", ptr %51, i64 1
  %53 = call <2 x float> @_ZN6bicudo4vec2miERKS0_(ptr noundef nonnull align 4 dereferenceable(8) %50, ptr noundef nonnull align 4 dereferenceable(8) %52)
  %54 = getelementptr inbounds %"struct.bicudo::vec2", ptr %12, i32 0, i32 0
  %55 = getelementptr inbounds %union.anon, ptr %54, i32 0, i32 0
  store <2 x float> %53, ptr %55, align 4
  %56 = call <2 x float> @_ZN6bicudo4vec29normalizeEv(ptr noundef nonnull align 4 dereferenceable(8) %12)
  %57 = getelementptr inbounds %"struct.bicudo::vec2", ptr %11, i32 0, i32 0
  %58 = getelementptr inbounds %union.anon, ptr %57, i32 0, i32 0
  store <2 x float> %56, ptr %58, align 4
  %59 = load ptr, ptr %3, align 8, !tbaa !5
  %60 = getelementptr inbounds %"struct.bicudo::vec2", ptr %59, i64 3
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %60, ptr align 4 %11, i64 8, i1 false), !tbaa.struct !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  ret void
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local <2 x float> @_ZN6bicudo4vec2miERKS0_(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(8)) #3 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local <2 x float> @_ZN6bicudo4vec29normalizeEv(ptr noundef nonnull align 4 dereferenceable(8)) #3 align 2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress 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 #3 = { inlinehint mustprogress 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++ TBAA"}
!9 = !{i64 0, i64 8, !10}
!10 = !{!7, !7, 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.bicudo::vec2" = type { %union.anon }
%union.anon = type { %struct.anon }
%struct.anon = type { float, float }

; 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 @_ZN6bicudo23splash_edges_normalizedEPNS_4vec2ES1_(ptr nocapture noundef writeonly %0, ptr noundef %1) local_unnamed_addr #1 {
  %3 = alloca %"struct.bicudo::vec2", align 8
  %4 = alloca %"struct.bicudo::vec2", align 8
  %5 = alloca %"struct.bicudo::vec2", align 8
  %6 = alloca %"struct.bicudo::vec2", align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #3
  %7 = getelementptr inbounds i8, ptr %1, i64 8
  %8 = getelementptr inbounds i8, ptr %1, i64 16
  %9 = tail call <2 x float> @_ZN6bicudo4vec2miERKS0_(ptr noundef nonnull align 4 dereferenceable(8) %7, ptr noundef nonnull align 4 dereferenceable(8) %8)
  store <2 x float> %9, ptr %3, align 8
  %10 = call <2 x float> @_ZN6bicudo4vec29normalizeEv(ptr noundef nonnull align 4 dereferenceable(8) %3)
  store <2 x float> %10, ptr %0, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #3
  %11 = getelementptr inbounds i8, ptr %1, i64 24
  %12 = call <2 x float> @_ZN6bicudo4vec2miERKS0_(ptr noundef nonnull align 4 dereferenceable(8) %8, ptr noundef nonnull align 4 dereferenceable(8) %11)
  store <2 x float> %12, ptr %4, align 8
  %13 = call <2 x float> @_ZN6bicudo4vec29normalizeEv(ptr noundef nonnull align 4 dereferenceable(8) %4)
  %14 = getelementptr inbounds i8, ptr %0, i64 8
  store <2 x float> %13, ptr %14, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #3
  %15 = call <2 x float> @_ZN6bicudo4vec2miERKS0_(ptr noundef nonnull align 4 dereferenceable(8) %11, ptr noundef nonnull align 4 dereferenceable(8) %1)
  store <2 x float> %15, ptr %5, align 8
  %16 = call <2 x float> @_ZN6bicudo4vec29normalizeEv(ptr noundef nonnull align 4 dereferenceable(8) %5)
  %17 = getelementptr inbounds i8, ptr %0, i64 16
  store <2 x float> %16, ptr %17, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #3
  %18 = call <2 x float> @_ZN6bicudo4vec2miERKS0_(ptr noundef nonnull align 4 dereferenceable(8) %1, ptr noundef nonnull align 4 dereferenceable(8) %7)
  store <2 x float> %18, ptr %6, align 8
  %19 = call <2 x float> @_ZN6bicudo4vec29normalizeEv(ptr noundef nonnull align 4 dereferenceable(8) %6)
  %20 = getelementptr inbounds i8, ptr %0, i64 24
  store <2 x float> %19, ptr %20, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #3
  ret void
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local <2 x float> @_ZN6bicudo4vec2miERKS0_(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(8)) local_unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local <2 x float> @_ZN6bicudo4vec29normalizeEv(ptr noundef nonnull align 4 dereferenceable(8)) local_unnamed_addr #2 align 2

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress 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 = { inlinehint mustprogress 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 #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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}


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