; LLVM IR from atlantis13579/Riemann :: Src/CollisionPrimitive (OrientedBox3)

; 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.Maths::TVector3" = type { 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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(12) ptr @_ZN5Maths8TVector3IfEaSERKS1_(ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(12)) #1 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef float @_ZNK5Maths8TVector3IfE3DotERKS1_(ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(12)) #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZNK7Riemann12OrientedBox314PenetratePlaneERKN5Maths8TVector3IfEEfPS3_Pf(ptr noundef nonnull align 4 dereferenceable(60) %0, ptr noundef nonnull align 4 dereferenceable(12) %1, float noundef %2, ptr noundef %3, ptr noundef %4) #2 align 2 {
  %6 = alloca i1, align 1
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca float, align 4
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca [8 x %"class.Maths::TVector3"], align 16
  %13 = alloca float, align 4
  %14 = alloca i32, align 4
  %15 = alloca float, align 4
  %16 = alloca i32, align 4
  store ptr %0, ptr %7, align 8, !tbaa !5
  store ptr %1, ptr %8, align 8, !tbaa !5
  store float %2, ptr %9, align 4, !tbaa !9
  store ptr %3, ptr %10, align 8, !tbaa !5
  store ptr %4, ptr %11, align 8, !tbaa !5
  %17 = load ptr, ptr %7, align 8
  call void @llvm.lifetime.start.p0(i64 96, ptr %12) #3
  %18 = getelementptr inbounds [8 x %"class.Maths::TVector3"], ptr %12, i32 0, i32 0
  %19 = getelementptr inbounds %"class.Maths::TVector3", ptr %18, i64 8
  br label %20

20:                                               ; preds = %20, %5
  %21 = phi ptr [ %18, %5 ], [ %22, %20 ]
  call void @_ZN5Maths8TVector3IfEC2Ev(ptr noundef nonnull align 4 dereferenceable(12) %21)
  %22 = getelementptr inbounds %"class.Maths::TVector3", ptr %21, i64 1
  %23 = icmp eq ptr %22, %19
  br i1 %23, label %24, label %20

24:                                               ; preds = %20
  %25 = getelementptr inbounds [8 x %"class.Maths::TVector3"], ptr %12, i64 0, i64 0
  call void @_ZNK7Riemann12OrientedBox311GetVerticesEPN5Maths8TVector3IfEE(ptr noundef nonnull align 4 dereferenceable(60) %17, ptr noundef %25)
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #3
  store float 0x47EFFFFFE0000000, ptr %13, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #3
  store i32 0, ptr %14, align 4, !tbaa !11
  br label %26

26:                                               ; preds = %44, %24
  %27 = load i32, ptr %14, align 4, !tbaa !11
  %28 = icmp slt i32 %27, 8
  br i1 %28, label %30, label %29

29:                                               ; preds = %26
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #3
  br label %47

30:                                               ; preds = %26
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #3
  %31 = load ptr, ptr %8, align 8, !tbaa !5
  %32 = load i32, ptr %14, align 4, !tbaa !11
  %33 = sext i32 %32 to i64
  %34 = getelementptr inbounds [8 x %"class.Maths::TVector3"], ptr %12, i64 0, i64 %33
  %35 = call noundef float @_ZNK5Maths8TVector3IfE3DotERKS1_(ptr noundef nonnull align 4 dereferenceable(12) %31, ptr noundef nonnull align 4 dereferenceable(12) %34)
  %36 = load float, ptr %9, align 4, !tbaa !9
  %37 = fadd float %35, %36
  store float %37, ptr %15, align 4, !tbaa !9
  %38 = load float, ptr %15, align 4, !tbaa !9
  %39 = load float, ptr %13, align 4, !tbaa !9
  %40 = fcmp olt float %38, %39
  br i1 %40, label %41, label %43

41:                                               ; preds = %30
  %42 = load float, ptr %15, align 4, !tbaa !9
  store float %42, ptr %13, align 4, !tbaa !9
  br label %43

43:                                               ; preds = %41, %30
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #3
  br label %44

44:                                               ; preds = %43
  %45 = load i32, ptr %14, align 4, !tbaa !11
  %46 = add nsw i32 %45, 1
  store i32 %46, ptr %14, align 4, !tbaa !11
  br label %26, !llvm.loop !13

47:                                               ; preds = %29
  %48 = load float, ptr %13, align 4, !tbaa !9
  %49 = fcmp ogt float %48, 0.000000e+00
  br i1 %49, label %50, label %51

50:                                               ; preds = %47
  store i1 false, ptr %6, align 1
  store i32 1, ptr %16, align 4
  br label %58

51:                                               ; preds = %47
  %52 = load ptr, ptr %8, align 8, !tbaa !5
  %53 = load ptr, ptr %10, align 8, !tbaa !5
  %54 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZN5Maths8TVector3IfEaSERKS1_(ptr noundef nonnull align 4 dereferenceable(12) %53, ptr noundef nonnull align 4 dereferenceable(12) %52)
  %55 = load float, ptr %13, align 4, !tbaa !9
  %56 = fneg float %55
  %57 = load ptr, ptr %11, align 8, !tbaa !5
  store float %56, ptr %57, align 4, !tbaa !9
  store i1 true, ptr %6, align 1
  store i32 1, ptr %16, align 4
  br label %58

58:                                               ; preds = %51, %50
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #3
  call void @llvm.lifetime.end.p0(i64 96, ptr %12) #3
  %59 = load i1, ptr %6, align 1
  ret i1 %59
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK7Riemann12OrientedBox311GetVerticesEPN5Maths8TVector3IfEE(ptr noundef nonnull align 4 dereferenceable(60), ptr noundef) #2 align 2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { inlinehint 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 #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 = !{!10, !10, i64 0}
!10 = !{!"float", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}


; 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.Maths::TVector3" = type { float, 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: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN5Maths8TVector3IfEC2Ev(ptr noundef nonnull align 4 dereferenceable(12)) unnamed_addr #1 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(12) ptr @_ZN5Maths8TVector3IfEaSERKS1_(ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(12)) local_unnamed_addr #1 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef float @_ZNK5Maths8TVector3IfE3DotERKS1_(ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(12)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZNK7Riemann12OrientedBox314PenetratePlaneERKN5Maths8TVector3IfEEfPS3_Pf(ptr noundef nonnull align 4 dereferenceable(60) %0, ptr noundef nonnull align 4 dereferenceable(12) %1, float noundef %2, ptr noundef %3, ptr nocapture noundef writeonly %4) local_unnamed_addr #2 align 2 {
  %6 = alloca [8 x %"class.Maths::TVector3"], align 16
  call void @llvm.lifetime.start.p0(i64 96, ptr nonnull %6) #3
  call void @_ZN5Maths8TVector3IfEC2Ev(ptr noundef nonnull align 4 dereferenceable(12) %6)
  %.ptr.1 = getelementptr inbounds i8, ptr %6, i64 12
  call void @_ZN5Maths8TVector3IfEC2Ev(ptr noundef nonnull align 4 dereferenceable(12) %.ptr.1)
  %.ptr.2 = getelementptr inbounds i8, ptr %6, i64 24
  call void @_ZN5Maths8TVector3IfEC2Ev(ptr noundef nonnull align 4 dereferenceable(12) %.ptr.2)
  %.ptr.3 = getelementptr inbounds i8, ptr %6, i64 36
  call void @_ZN5Maths8TVector3IfEC2Ev(ptr noundef nonnull align 4 dereferenceable(12) %.ptr.3)
  %.ptr.4 = getelementptr inbounds i8, ptr %6, i64 48
  call void @_ZN5Maths8TVector3IfEC2Ev(ptr noundef nonnull align 4 dereferenceable(12) %.ptr.4)
  %.ptr.5 = getelementptr inbounds i8, ptr %6, i64 60
  call void @_ZN5Maths8TVector3IfEC2Ev(ptr noundef nonnull align 4 dereferenceable(12) %.ptr.5)
  %.ptr.6 = getelementptr inbounds i8, ptr %6, i64 72
  call void @_ZN5Maths8TVector3IfEC2Ev(ptr noundef nonnull align 4 dereferenceable(12) %.ptr.6)
  %.ptr.7 = getelementptr inbounds i8, ptr %6, i64 84
  call void @_ZN5Maths8TVector3IfEC2Ev(ptr noundef nonnull align 4 dereferenceable(12) %.ptr.7)
  call void @_ZNK7Riemann12OrientedBox311GetVerticesEPN5Maths8TVector3IfEE(ptr noundef nonnull align 4 dereferenceable(60) %0, ptr noundef nonnull %6)
  %7 = call noundef float @_ZNK5Maths8TVector3IfE3DotERKS1_(ptr noundef nonnull align 4 dereferenceable(12) %1, ptr noundef nonnull align 4 dereferenceable(12) %6)
  %8 = fadd float %7, %2
  %9 = fcmp olt float %8, 0x47EFFFFFE0000000
  %.1 = select i1 %9, float %8, float 0x47EFFFFFE0000000
  %10 = call noundef float @_ZNK5Maths8TVector3IfE3DotERKS1_(ptr noundef nonnull align 4 dereferenceable(12) %1, ptr noundef nonnull align 4 dereferenceable(12) %.ptr.1)
  %11 = fadd float %10, %2
  %12 = fcmp olt float %11, %.1
  %.1.1 = select i1 %12, float %11, float %.1
  %13 = call noundef float @_ZNK5Maths8TVector3IfE3DotERKS1_(ptr noundef nonnull align 4 dereferenceable(12) %1, ptr noundef nonnull align 4 dereferenceable(12) %.ptr.2)
  %14 = fadd float %13, %2
  %15 = fcmp olt float %14, %.1.1
  %.1.2 = select i1 %15, float %14, float %.1.1
  %16 = call noundef float @_ZNK5Maths8TVector3IfE3DotERKS1_(ptr noundef nonnull align 4 dereferenceable(12) %1, ptr noundef nonnull align 4 dereferenceable(12) %.ptr.3)
  %17 = fadd float %16, %2
  %18 = fcmp olt float %17, %.1.2
  %.1.3 = select i1 %18, float %17, float %.1.2
  %19 = call noundef float @_ZNK5Maths8TVector3IfE3DotERKS1_(ptr noundef nonnull align 4 dereferenceable(12) %1, ptr noundef nonnull align 4 dereferenceable(12) %.ptr.4)
  %20 = fadd float %19, %2
  %21 = fcmp olt float %20, %.1.3
  %.1.4 = select i1 %21, float %20, float %.1.3
  %22 = call noundef float @_ZNK5Maths8TVector3IfE3DotERKS1_(ptr noundef nonnull align 4 dereferenceable(12) %1, ptr noundef nonnull align 4 dereferenceable(12) %.ptr.5)
  %23 = fadd float %22, %2
  %24 = fcmp olt float %23, %.1.4
  %.1.5 = select i1 %24, float %23, float %.1.4
  %25 = call noundef float @_ZNK5Maths8TVector3IfE3DotERKS1_(ptr noundef nonnull align 4 dereferenceable(12) %1, ptr noundef nonnull align 4 dereferenceable(12) %.ptr.6)
  %26 = fadd float %25, %2
  %27 = fcmp olt float %26, %.1.5
  %.1.6 = select i1 %27, float %26, float %.1.5
  %28 = call noundef float @_ZNK5Maths8TVector3IfE3DotERKS1_(ptr noundef nonnull align 4 dereferenceable(12) %1, ptr noundef nonnull align 4 dereferenceable(12) %.ptr.7)
  %29 = fadd float %28, %2
  %30 = fcmp olt float %29, %.1.6
  %.1.7 = select i1 %30, float %29, float %.1.6
  %31 = fcmp ule float %.1.7, 0.000000e+00
  br i1 %31, label %32, label %35

32:                                               ; preds = %5
  %33 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZN5Maths8TVector3IfEaSERKS1_(ptr noundef nonnull align 4 dereferenceable(12) %3, ptr noundef nonnull align 4 dereferenceable(12) %1)
  %34 = fneg float %.1.7
  store float %34, ptr %4, align 4, !tbaa !5
  br label %35

35:                                               ; preds = %5, %32
  call void @llvm.lifetime.end.p0(i64 96, ptr nonnull %6) #3
  ret i1 %31
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK7Riemann12OrientedBox311GetVerticesEPN5Maths8TVector3IfEE(ptr noundef nonnull align 4 dereferenceable(60), ptr noundef) local_unnamed_addr #2 align 2

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


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,LCSSAPass,LoopRotatePass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass