; LLVM IR from yangfengzzz/DigitalVox4 :: vox.math (collision_utils)

; 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.vox::Point" = type { float, float, float }
%"class.vox::BoundingBox" = type { %"class.vox::Point", %"class.vox::Point" }
%"class.vox::BoundingPlane" = type { %"class.vox::Vector", float }
%"class.vox::Vector" = type { float, float, float }

; Function Attrs: mustprogress uwtable
declare dso_local noundef float @_ZN3vox21distancePlaneAndPointERKNS_13BoundingPlaneIfLm3EEERKNS_5PointIfLm3EEE(ptr noundef nonnull align 4 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(12)) #0

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN3vox21intersectsPlaneAndBoxERKNS_13BoundingPlaneIfLm3EEERKNS_11BoundingBoxIfLm3EEE(ptr noundef nonnull align 4 dereferenceable(16) %0, ptr noundef nonnull align 4 dereferenceable(24) %1) #0 {
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca %"class.vox::Point", align 4
  %10 = alloca %"class.vox::Point", align 4
  %11 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #3
  %12 = load ptr, ptr %5, align 8, !tbaa !5
  %13 = getelementptr inbounds %"class.vox::BoundingBox", ptr %12, i32 0, i32 0
  store ptr %13, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #3
  %14 = load ptr, ptr %5, align 8, !tbaa !5
  %15 = getelementptr inbounds %"class.vox::BoundingBox", ptr %14, i32 0, i32 1
  store ptr %15, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #3
  %16 = load ptr, ptr %4, align 8, !tbaa !5
  %17 = getelementptr inbounds %"class.vox::BoundingPlane", ptr %16, i32 0, i32 0
  store ptr %17, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 12, ptr %9) #3
  call void @_ZN3vox5PointIfLm3EEC2Ev(ptr noundef nonnull align 4 dereferenceable(12) %9)
  call void @llvm.lifetime.start.p0(i64 12, ptr %10) #3
  call void @_ZN3vox5PointIfLm3EEC2Ev(ptr noundef nonnull align 4 dereferenceable(12) %10)
  %18 = load ptr, ptr %8, align 8, !tbaa !5
  %19 = getelementptr inbounds %"class.vox::Vector", ptr %18, i32 0, i32 0
  %20 = load float, ptr %19, align 4, !tbaa !9
  %21 = fcmp oge float %20, 0.000000e+00
  br i1 %21, label %22, label %31

22:                                               ; preds = %2
  %23 = load ptr, ptr %7, align 8, !tbaa !5
  %24 = getelementptr inbounds %"class.vox::Point", ptr %23, i32 0, i32 0
  %25 = load float, ptr %24, align 4, !tbaa !12
  %26 = getelementptr inbounds %"class.vox::Point", ptr %9, i32 0, i32 0
  store float %25, ptr %26, align 4, !tbaa !12
  %27 = load ptr, ptr %6, align 8, !tbaa !5
  %28 = getelementptr inbounds %"class.vox::Point", ptr %27, i32 0, i32 0
  %29 = load float, ptr %28, align 4, !tbaa !12
  %30 = getelementptr inbounds %"class.vox::Point", ptr %10, i32 0, i32 0
  store float %29, ptr %30, align 4, !tbaa !12
  br label %40

31:                                               ; preds = %2
  %32 = load ptr, ptr %6, align 8, !tbaa !5
  %33 = getelementptr inbounds %"class.vox::Point", ptr %32, i32 0, i32 0
  %34 = load float, ptr %33, align 4, !tbaa !12
  %35 = getelementptr inbounds %"class.vox::Point", ptr %9, i32 0, i32 0
  store float %34, ptr %35, align 4, !tbaa !12
  %36 = load ptr, ptr %7, align 8, !tbaa !5
  %37 = getelementptr inbounds %"class.vox::Point", ptr %36, i32 0, i32 0
  %38 = load float, ptr %37, align 4, !tbaa !12
  %39 = getelementptr inbounds %"class.vox::Point", ptr %10, i32 0, i32 0
  store float %38, ptr %39, align 4, !tbaa !12
  br label %40

40:                                               ; preds = %31, %22
  %41 = load ptr, ptr %8, align 8, !tbaa !5
  %42 = getelementptr inbounds %"class.vox::Vector", ptr %41, i32 0, i32 1
  %43 = load float, ptr %42, align 4, !tbaa !14
  %44 = fcmp oge float %43, 0.000000e+00
  br i1 %44, label %45, label %54

45:                                               ; preds = %40
  %46 = load ptr, ptr %7, align 8, !tbaa !5
  %47 = getelementptr inbounds %"class.vox::Point", ptr %46, i32 0, i32 1
  %48 = load float, ptr %47, align 4, !tbaa !15
  %49 = getelementptr inbounds %"class.vox::Point", ptr %9, i32 0, i32 1
  store float %48, ptr %49, align 4, !tbaa !15
  %50 = load ptr, ptr %6, align 8, !tbaa !5
  %51 = getelementptr inbounds %"class.vox::Point", ptr %50, i32 0, i32 1
  %52 = load float, ptr %51, align 4, !tbaa !15
  %53 = getelementptr inbounds %"class.vox::Point", ptr %10, i32 0, i32 1
  store float %52, ptr %53, align 4, !tbaa !15
  br label %63

54:                                               ; preds = %40
  %55 = load ptr, ptr %6, align 8, !tbaa !5
  %56 = getelementptr inbounds %"class.vox::Point", ptr %55, i32 0, i32 1
  %57 = load float, ptr %56, align 4, !tbaa !15
  %58 = getelementptr inbounds %"class.vox::Point", ptr %9, i32 0, i32 1
  store float %57, ptr %58, align 4, !tbaa !15
  %59 = load ptr, ptr %7, align 8, !tbaa !5
  %60 = getelementptr inbounds %"class.vox::Point", ptr %59, i32 0, i32 1
  %61 = load float, ptr %60, align 4, !tbaa !15
  %62 = getelementptr inbounds %"class.vox::Point", ptr %10, i32 0, i32 1
  store float %61, ptr %62, align 4, !tbaa !15
  br label %63

63:                                               ; preds = %54, %45
  %64 = load ptr, ptr %8, align 8, !tbaa !5
  %65 = getelementptr inbounds %"class.vox::Vector", ptr %64, i32 0, i32 2
  %66 = load float, ptr %65, align 4, !tbaa !16
  %67 = fcmp oge float %66, 0.000000e+00
  br i1 %67, label %68, label %77

68:                                               ; preds = %63
  %69 = load ptr, ptr %7, align 8, !tbaa !5
  %70 = getelementptr inbounds %"class.vox::Point", ptr %69, i32 0, i32 2
  %71 = load float, ptr %70, align 4, !tbaa !17
  %72 = getelementptr inbounds %"class.vox::Point", ptr %9, i32 0, i32 2
  store float %71, ptr %72, align 4, !tbaa !17
  %73 = load ptr, ptr %6, align 8, !tbaa !5
  %74 = getelementptr inbounds %"class.vox::Point", ptr %73, i32 0, i32 2
  %75 = load float, ptr %74, align 4, !tbaa !17
  %76 = getelementptr inbounds %"class.vox::Point", ptr %10, i32 0, i32 2
  store float %75, ptr %76, align 4, !tbaa !17
  br label %86

77:                                               ; preds = %63
  %78 = load ptr, ptr %6, align 8, !tbaa !5
  %79 = getelementptr inbounds %"class.vox::Point", ptr %78, i32 0, i32 2
  %80 = load float, ptr %79, align 4, !tbaa !17
  %81 = getelementptr inbounds %"class.vox::Point", ptr %9, i32 0, i32 2
  store float %80, ptr %81, align 4, !tbaa !17
  %82 = load ptr, ptr %7, align 8, !tbaa !5
  %83 = getelementptr inbounds %"class.vox::Point", ptr %82, i32 0, i32 2
  %84 = load float, ptr %83, align 4, !tbaa !17
  %85 = getelementptr inbounds %"class.vox::Point", ptr %10, i32 0, i32 2
  store float %84, ptr %85, align 4, !tbaa !17
  br label %86

86:                                               ; preds = %77, %68
  %87 = load ptr, ptr %4, align 8, !tbaa !5
  %88 = call noundef float @_ZN3vox21distancePlaneAndPointERKNS_13BoundingPlaneIfLm3EEERKNS_5PointIfLm3EEE(ptr noundef nonnull align 4 dereferenceable(16) %87, ptr noundef nonnull align 4 dereferenceable(12) %9)
  %89 = fcmp olt float %88, 0.000000e+00
  br i1 %89, label %90, label %91

90:                                               ; preds = %86
  store i32 0, ptr %3, align 4
  store i32 1, ptr %11, align 4
  br label %97

91:                                               ; preds = %86
  %92 = load ptr, ptr %4, align 8, !tbaa !5
  %93 = call noundef float @_ZN3vox21distancePlaneAndPointERKNS_13BoundingPlaneIfLm3EEERKNS_5PointIfLm3EEE(ptr noundef nonnull align 4 dereferenceable(16) %92, ptr noundef nonnull align 4 dereferenceable(12) %10)
  %94 = fcmp ogt float %93, 0.000000e+00
  br i1 %94, label %95, label %96

95:                                               ; preds = %91
  store i32 1, ptr %3, align 4
  store i32 1, ptr %11, align 4
  br label %97

96:                                               ; preds = %91
  store i32 2, ptr %3, align 4
  store i32 1, ptr %11, align 4
  br label %97

97:                                               ; preds = %96, %95, %90
  call void @llvm.lifetime.end.p0(i64 12, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 12, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #3
  %98 = load i32, ptr %3, align 4
  ret i32 %98
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3vox5PointIfLm3EEC2Ev(ptr noundef nonnull align 4 dereferenceable(12)) unnamed_addr #2 align 2

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nounwind 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 = !{!10, !11, i64 0}
!10 = !{!"_ZTSN3vox6VectorIfLm3EEE", !11, i64 0, !11, i64 4, !11, i64 8}
!11 = !{!"float", !7, i64 0}
!12 = !{!13, !11, i64 0}
!13 = !{!"_ZTSN3vox5PointIfLm3EEE", !11, i64 0, !11, i64 4, !11, i64 8}
!14 = !{!10, !11, i64 4}
!15 = !{!13, !11, i64 4}
!16 = !{!10, !11, i64 8}
!17 = !{!13, !11, i64 8}


; 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.vox::Point" = type { float, float, float }

; Function Attrs: mustprogress uwtable
declare dso_local noundef float @_ZN3vox21distancePlaneAndPointERKNS_13BoundingPlaneIfLm3EEERKNS_5PointIfLm3EEE(ptr noundef nonnull align 4 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(12)) local_unnamed_addr #0

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef range(i32 0, 3) i32 @_ZN3vox21intersectsPlaneAndBoxERKNS_13BoundingPlaneIfLm3EEERKNS_11BoundingBoxIfLm3EEE(ptr noundef nonnull align 4 dereferenceable(16) %0, ptr nocapture noundef nonnull readonly align 4 dereferenceable(24) %1) local_unnamed_addr #0 {
  %3 = alloca %"class.vox::Point", align 4
  %4 = alloca %"class.vox::Point", align 4
  %5 = getelementptr inbounds i8, ptr %1, i64 12
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %3) #3
  call void @_ZN3vox5PointIfLm3EEC2Ev(ptr noundef nonnull align 4 dereferenceable(12) %3)
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %4) #3
  call void @_ZN3vox5PointIfLm3EEC2Ev(ptr noundef nonnull align 4 dereferenceable(12) %4)
  %6 = load float, ptr %0, align 4, !tbaa !5
  %7 = fcmp ult float %6, 0.000000e+00
  %.val = load float, ptr %1, align 4
  %.val23 = load float, ptr %5, align 4
  %storemerge20 = select i1 %7, float %.val, float %.val23
  store float %storemerge20, ptr %3, align 4, !tbaa !10
  %storemerge = select i1 %7, float %.val23, float %.val
  store float %storemerge, ptr %4, align 4, !tbaa !10
  %8 = getelementptr inbounds i8, ptr %0, i64 4
  %9 = load float, ptr %8, align 4, !tbaa !12
  %10 = fcmp ult float %9, 0.000000e+00
  %. = select i1 %10, i64 4, i64 16
  %.33 = select i1 %10, i64 16, i64 4
  %11 = getelementptr inbounds i8, ptr %1, i64 %.
  %12 = getelementptr inbounds i8, ptr %1, i64 %.33
  %.sink = load float, ptr %12, align 4, !tbaa !13
  %.sink26 = load float, ptr %11, align 4, !tbaa !13
  %13 = getelementptr inbounds i8, ptr %3, i64 4
  store float %.sink26, ptr %13, align 4
  %14 = getelementptr inbounds i8, ptr %4, i64 4
  store float %.sink, ptr %14, align 4
  %15 = getelementptr inbounds i8, ptr %0, i64 8
  %16 = load float, ptr %15, align 4, !tbaa !14
  %17 = fcmp ult float %16, 0.000000e+00
  %.sink32 = select i1 %17, i64 8, i64 20
  %.sink31 = select i1 %17, i64 20, i64 8
  %18 = getelementptr inbounds i8, ptr %1, i64 %.sink32
  %19 = getelementptr inbounds i8, ptr %1, i64 %.sink31
  %.sink27 = load float, ptr %19, align 4, !tbaa !15
  %.sink28 = load float, ptr %18, align 4, !tbaa !15
  %20 = getelementptr inbounds i8, ptr %3, i64 8
  store float %.sink28, ptr %20, align 4
  %21 = getelementptr inbounds i8, ptr %4, i64 8
  store float %.sink27, ptr %21, align 4
  %22 = call noundef float @_ZN3vox21distancePlaneAndPointERKNS_13BoundingPlaneIfLm3EEERKNS_5PointIfLm3EEE(ptr noundef nonnull align 4 dereferenceable(16) %0, ptr noundef nonnull align 4 dereferenceable(12) %3)
  %23 = fcmp olt float %22, 0.000000e+00
  br i1 %23, label %27, label %24

24:                                               ; preds = %2
  %25 = call noundef float @_ZN3vox21distancePlaneAndPointERKNS_13BoundingPlaneIfLm3EEERKNS_5PointIfLm3EEE(ptr noundef nonnull align 4 dereferenceable(16) %0, ptr noundef nonnull align 4 dereferenceable(12) %4)
  %26 = fcmp ogt float %25, 0.000000e+00
  %.22 = select i1 %26, i32 1, i32 2
  br label %27

27:                                               ; preds = %24, %2
  %.0 = phi i32 [ 0, %2 ], [ %.22, %24 ]
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %4) #3
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %3) #3
  ret i32 %.0
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3vox5PointIfLm3EEC2Ev(ptr noundef nonnull align 4 dereferenceable(12)) unnamed_addr #2 align 2

attributes #0 = { 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nounwind 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, !7, i64 0}
!6 = !{!"_ZTSN3vox6VectorIfLm3EEE", !7, i64 0, !7, i64 4, !7, i64 8}
!7 = !{!"float", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!11, !7, i64 0}
!11 = !{!"_ZTSN3vox5PointIfLm3EEE", !7, i64 0, !7, i64 4, !7, i64 8}
!12 = !{!6, !7, i64 4}
!13 = !{!11, !7, i64 4}
!14 = !{!6, !7, i64 8}
!15 = !{!11, !7, i64 8}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,MergedLoadStoreMotionPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass