; LLVM IR from sejja/3D-Software-Rasterizer :: Rasterizer/Engine/Types/Box.ll (Z21linePlaneIntersectionR6Point4RKS_S2_R7Vector4)

; 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.Vector4 = type { %union.anon.1 }
%union.anon.1 = type { [4 x float] }
%class.Point4 = type { %union.anon }
%union.anon = type { [4 x float] }
%struct.anon = type { float, float, float, float }
%struct.anon.2 = type { float, float, 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 nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

declare noundef float @_ZNK7Vector43DotERKS_(ptr noundef nonnull align 4 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(16)) #1

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_Z21linePlaneIntersectionR6Point4RKS_S2_R7Vector4(ptr noundef nonnull align 4 dereferenceable(16) %0, ptr noundef nonnull align 4 dereferenceable(16) %1, ptr noundef nonnull align 4 dereferenceable(16) %2, ptr noundef nonnull align 4 dereferenceable(16) %3) #2 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca %class.Vector4, align 4
  %10 = alloca %class.Vector4, align 4
  %11 = alloca %class.Vector4, align 4
  %12 = alloca %class.Vector4, align 4
  %13 = alloca %class.Vector4, align 4
  %14 = alloca %class.Vector4, align 4
  %15 = alloca %class.Vector4, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store ptr %2, ptr %7, align 8, !tbaa !5
  store ptr %3, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr %9) #3
  %16 = load ptr, ptr %6, align 8, !tbaa !5
  %17 = getelementptr inbounds %class.Point4, ptr %16, i32 0, i32 0
  %18 = getelementptr inbounds %struct.anon, ptr %17, i32 0, i32 0
  %19 = load float, ptr %18, align 4, !tbaa !9
  %20 = load ptr, ptr %6, align 8, !tbaa !5
  %21 = getelementptr inbounds %class.Point4, ptr %20, i32 0, i32 0
  %22 = getelementptr inbounds %struct.anon, ptr %21, i32 0, i32 1
  %23 = load float, ptr %22, align 4, !tbaa !9
  %24 = load ptr, ptr %6, align 8, !tbaa !5
  %25 = getelementptr inbounds %class.Point4, ptr %24, i32 0, i32 0
  %26 = getelementptr inbounds %struct.anon, ptr %25, i32 0, i32 2
  %27 = load float, ptr %26, align 4, !tbaa !9
  call void @_ZN7Vector4C1Effff(ptr noundef nonnull align 4 dereferenceable(16) %9, float noundef %19, float noundef %23, float noundef %27, float noundef 0.000000e+00)
  call void @llvm.lifetime.start.p0(i64 16, ptr %10) #3
  %28 = load ptr, ptr %7, align 8, !tbaa !5
  %29 = getelementptr inbounds %class.Point4, ptr %28, i32 0, i32 0
  %30 = getelementptr inbounds %struct.anon, ptr %29, i32 0, i32 0
  %31 = load float, ptr %30, align 4, !tbaa !9
  %32 = load ptr, ptr %7, align 8, !tbaa !5
  %33 = getelementptr inbounds %class.Point4, ptr %32, i32 0, i32 0
  %34 = getelementptr inbounds %struct.anon, ptr %33, i32 0, i32 1
  %35 = load float, ptr %34, align 4, !tbaa !9
  %36 = load ptr, ptr %7, align 8, !tbaa !5
  %37 = getelementptr inbounds %class.Point4, ptr %36, i32 0, i32 0
  %38 = getelementptr inbounds %struct.anon, ptr %37, i32 0, i32 2
  %39 = load float, ptr %38, align 4, !tbaa !9
  call void @_ZN7Vector4C1Effff(ptr noundef nonnull align 4 dereferenceable(16) %10, float noundef %31, float noundef %35, float noundef %39, float noundef 0.000000e+00)
  call void @llvm.lifetime.start.p0(i64 16, ptr %11) #3
  call void @llvm.lifetime.start.p0(i64 16, ptr %12) #3
  call void @llvm.lifetime.start.p0(i64 16, ptr %13) #3
  call void @llvm.lifetime.start.p0(i64 16, ptr %14) #3
  call void @_ZNK7Vector4miERKS_(ptr dead_on_unwind writable sret(%class.Vector4) align 4 %14, ptr noundef nonnull align 4 dereferenceable(16) %10, ptr noundef nonnull align 4 dereferenceable(16) %9)
  %40 = load ptr, ptr %8, align 8, !tbaa !5
  %41 = call noundef float @_ZNK7Vector43DotERKS_(ptr noundef nonnull align 4 dereferenceable(16) %40, ptr noundef nonnull align 4 dereferenceable(16) %9)
  %42 = fneg float %41
  %43 = load ptr, ptr %8, align 8, !tbaa !5
  %44 = getelementptr inbounds %class.Vector4, ptr %43, i32 0, i32 0
  %45 = getelementptr inbounds %struct.anon.2, ptr %44, i32 0, i32 3
  %46 = load float, ptr %45, align 4, !tbaa !9
  %47 = fsub float %42, %46
  call void @_ZNK7Vector4mlEf(ptr dead_on_unwind writable sret(%class.Vector4) align 4 %13, ptr noundef nonnull align 4 dereferenceable(16) %14, float noundef %47)
  %48 = load ptr, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr %15) #3
  call void @_ZNK7Vector4miERKS_(ptr dead_on_unwind writable sret(%class.Vector4) align 4 %15, ptr noundef nonnull align 4 dereferenceable(16) %10, ptr noundef nonnull align 4 dereferenceable(16) %9)
  %49 = call noundef float @_ZNK7Vector43DotERKS_(ptr noundef nonnull align 4 dereferenceable(16) %48, ptr noundef nonnull align 4 dereferenceable(16) %15)
  call void @_ZNK7Vector4dvEf(ptr dead_on_unwind writable sret(%class.Vector4) align 4 %12, ptr noundef nonnull align 4 dereferenceable(16) %13, float noundef %49)
  call void @_ZNK7Vector4plERKS_(ptr dead_on_unwind writable sret(%class.Vector4) align 4 %11, ptr noundef nonnull align 4 dereferenceable(16) %9, ptr noundef nonnull align 4 dereferenceable(16) %12)
  call void @llvm.lifetime.end.p0(i64 16, ptr %15) #3
  call void @llvm.lifetime.end.p0(i64 16, ptr %14) #3
  call void @llvm.lifetime.end.p0(i64 16, ptr %13) #3
  call void @llvm.lifetime.end.p0(i64 16, ptr %12) #3
  %50 = getelementptr inbounds %class.Vector4, ptr %11, i32 0, i32 0
  %51 = getelementptr inbounds %struct.anon.2, ptr %50, i32 0, i32 0
  %52 = load float, ptr %51, align 4, !tbaa !9
  %53 = load ptr, ptr %5, align 8, !tbaa !5
  %54 = getelementptr inbounds %class.Point4, ptr %53, i32 0, i32 0
  %55 = getelementptr inbounds %struct.anon, ptr %54, i32 0, i32 0
  store float %52, ptr %55, align 4, !tbaa !9
  %56 = getelementptr inbounds %class.Vector4, ptr %11, i32 0, i32 0
  %57 = getelementptr inbounds %struct.anon.2, ptr %56, i32 0, i32 1
  %58 = load float, ptr %57, align 4, !tbaa !9
  %59 = load ptr, ptr %5, align 8, !tbaa !5
  %60 = getelementptr inbounds %class.Point4, ptr %59, i32 0, i32 0
  %61 = getelementptr inbounds %struct.anon, ptr %60, i32 0, i32 1
  store float %58, ptr %61, align 4, !tbaa !9
  %62 = getelementptr inbounds %class.Vector4, ptr %11, i32 0, i32 0
  %63 = getelementptr inbounds %struct.anon.2, ptr %62, i32 0, i32 2
  %64 = load float, ptr %63, align 4, !tbaa !9
  %65 = load ptr, ptr %5, align 8, !tbaa !5
  %66 = getelementptr inbounds %class.Point4, ptr %65, i32 0, i32 0
  %67 = getelementptr inbounds %struct.anon, ptr %66, i32 0, i32 2
  store float %64, ptr %67, align 4, !tbaa !9
  %68 = load ptr, ptr %5, align 8, !tbaa !5
  %69 = getelementptr inbounds %class.Point4, ptr %68, i32 0, i32 0
  %70 = getelementptr inbounds %struct.anon, ptr %69, i32 0, i32 3
  store float 1.000000e+00, ptr %70, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 16, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 16, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 16, ptr %9) #3
  ret i1 true
}

declare void @_ZN7Vector4C1Effff(ptr noundef nonnull align 4 dereferenceable(16), float noundef, float noundef, float noundef, float noundef) unnamed_addr #1

declare void @_ZNK7Vector4plERKS_(ptr dead_on_unwind writable sret(%class.Vector4) align 4, ptr noundef nonnull align 4 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(16)) #1

declare void @_ZNK7Vector4miERKS_(ptr dead_on_unwind writable sret(%class.Vector4) align 4, ptr noundef nonnull align 4 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(16)) #1

declare void @_ZNK7Vector4mlEf(ptr dead_on_unwind writable sret(%class.Vector4) align 4, ptr noundef nonnull align 4 dereferenceable(16), float noundef) #1

declare void @_ZNK7Vector4dvEf(ptr dead_on_unwind writable sret(%class.Vector4) align 4, ptr noundef nonnull align 4 dereferenceable(16), float noundef) #1

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 = { 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}


; 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.Vector4 = type { %union.anon.1 }
%union.anon.1 = type { [4 x 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

declare noundef float @_ZNK7Vector43DotERKS_(ptr noundef nonnull align 4 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(16)) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_Z21linePlaneIntersectionR6Point4RKS_S2_R7Vector4(ptr nocapture noundef nonnull writeonly align 4 dereferenceable(16) %0, ptr nocapture noundef nonnull readonly align 4 dereferenceable(16) %1, ptr nocapture noundef nonnull readonly align 4 dereferenceable(16) %2, ptr noundef nonnull align 4 dereferenceable(16) %3) local_unnamed_addr #2 {
  %5 = alloca %class.Vector4, align 4
  %6 = alloca %class.Vector4, align 4
  %7 = alloca %class.Vector4, align 8
  %8 = alloca %class.Vector4, align 4
  %9 = alloca %class.Vector4, align 4
  %10 = alloca %class.Vector4, align 4
  %11 = alloca %class.Vector4, align 4
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %5) #3
  %12 = load float, ptr %1, align 4, !tbaa !5
  %13 = getelementptr inbounds i8, ptr %1, i64 4
  %14 = load float, ptr %13, align 4, !tbaa !5
  %15 = getelementptr inbounds i8, ptr %1, i64 8
  %16 = load float, ptr %15, align 4, !tbaa !5
  call void @_ZN7Vector4C1Effff(ptr noundef nonnull align 4 dereferenceable(16) %5, float noundef %12, float noundef %14, float noundef %16, float noundef 0.000000e+00)
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %6) #3
  %17 = load float, ptr %2, align 4, !tbaa !5
  %18 = getelementptr inbounds i8, ptr %2, i64 4
  %19 = load float, ptr %18, align 4, !tbaa !5
  %20 = getelementptr inbounds i8, ptr %2, i64 8
  %21 = load float, ptr %20, align 4, !tbaa !5
  call void @_ZN7Vector4C1Effff(ptr noundef nonnull align 4 dereferenceable(16) %6, float noundef %17, float noundef %19, float noundef %21, float noundef 0.000000e+00)
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %7) #3
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %8) #3
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %9) #3
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %10) #3
  call void @_ZNK7Vector4miERKS_(ptr dead_on_unwind nonnull writable sret(%class.Vector4) align 4 %10, ptr noundef nonnull align 4 dereferenceable(16) %6, ptr noundef nonnull align 4 dereferenceable(16) %5)
  %22 = call noundef float @_ZNK7Vector43DotERKS_(ptr noundef nonnull align 4 dereferenceable(16) %3, ptr noundef nonnull align 4 dereferenceable(16) %5)
  %23 = fneg float %22
  %24 = getelementptr inbounds i8, ptr %3, i64 12
  %25 = load float, ptr %24, align 4, !tbaa !5
  %26 = fsub float %23, %25
  call void @_ZNK7Vector4mlEf(ptr dead_on_unwind nonnull writable sret(%class.Vector4) align 4 %9, ptr noundef nonnull align 4 dereferenceable(16) %10, float noundef %26)
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %11) #3
  call void @_ZNK7Vector4miERKS_(ptr dead_on_unwind nonnull writable sret(%class.Vector4) align 4 %11, ptr noundef nonnull align 4 dereferenceable(16) %6, ptr noundef nonnull align 4 dereferenceable(16) %5)
  %27 = call noundef float @_ZNK7Vector43DotERKS_(ptr noundef nonnull align 4 dereferenceable(16) %3, ptr noundef nonnull align 4 dereferenceable(16) %11)
  call void @_ZNK7Vector4dvEf(ptr dead_on_unwind nonnull writable sret(%class.Vector4) align 4 %8, ptr noundef nonnull align 4 dereferenceable(16) %9, float noundef %27)
  call void @_ZNK7Vector4plERKS_(ptr dead_on_unwind nonnull writable sret(%class.Vector4) align 4 %7, ptr noundef nonnull align 4 dereferenceable(16) %5, ptr noundef nonnull align 4 dereferenceable(16) %8)
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %11) #3
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %10) #3
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %9) #3
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %8) #3
  %28 = load <2 x float>, ptr %7, align 8, !tbaa !5
  store <2 x float> %28, ptr %0, align 4, !tbaa !5
  %29 = getelementptr inbounds i8, ptr %7, i64 8
  %30 = load float, ptr %29, align 8, !tbaa !5
  %31 = getelementptr inbounds i8, ptr %0, i64 8
  store float %30, ptr %31, align 4, !tbaa !5
  %32 = getelementptr inbounds i8, ptr %0, i64 12
  store float 1.000000e+00, ptr %32, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %7) #3
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %6) #3
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %5) #3
  ret i1 true
}

declare void @_ZN7Vector4C1Effff(ptr noundef nonnull align 4 dereferenceable(16), float noundef, float noundef, float noundef, float noundef) unnamed_addr #1

declare void @_ZNK7Vector4plERKS_(ptr dead_on_unwind writable sret(%class.Vector4) align 4, ptr noundef nonnull align 4 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(16)) local_unnamed_addr #1

declare void @_ZNK7Vector4miERKS_(ptr dead_on_unwind writable sret(%class.Vector4) align 4, ptr noundef nonnull align 4 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(16)) local_unnamed_addr #1

declare void @_ZNK7Vector4mlEf(ptr dead_on_unwind writable sret(%class.Vector4) align 4, ptr noundef nonnull align 4 dereferenceable(16), float noundef) local_unnamed_addr #1

declare void @_ZNK7Vector4dvEf(ptr dead_on_unwind writable sret(%class.Vector4) align 4, ptr noundef nonnull align 4 dereferenceable(16), float noundef) local_unnamed_addr #1

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 = { 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,SLPVectorizerPass,SROAPass