; LLVM IR from Slingshot-Physics/slingshot-community :: common/geometry/src (mesh)

; 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.geometry::types::aabb_t" = type { %class.Vector3, %class.Vector3 }
%class.Vector3 = type { [3 x float] }

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZNK7Vector3ixEj(ptr noundef nonnull align 4 dereferenceable(12), i32 noundef) #0 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN8geometry4mesh15pointInsideAabbERKNS_5types6aabb_tERK7Vector3f(ptr noundef nonnull align 4 dereferenceable(24) %0, ptr noundef nonnull align 4 dereferenceable(12) %1, float noundef %2) #1 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca float, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store float %2, ptr %6, align 4, !tbaa !9
  %7 = load ptr, ptr %5, align 8, !tbaa !5
  %8 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK7Vector3ixEj(ptr noundef nonnull align 4 dereferenceable(12) %7, i32 noundef 0)
  %9 = load float, ptr %8, align 4, !tbaa !9
  %10 = load ptr, ptr %4, align 8, !tbaa !5
  %11 = getelementptr inbounds %"struct.geometry::types::aabb_t", ptr %10, i32 0, i32 1
  %12 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK7Vector3ixEj(ptr noundef nonnull align 4 dereferenceable(12) %11, i32 noundef 0)
  %13 = load float, ptr %12, align 4, !tbaa !9
  %14 = load float, ptr %6, align 4, !tbaa !9
  %15 = fsub float %13, %14
  %16 = fcmp oge float %9, %15
  br i1 %16, label %17, label %74

17:                                               ; preds = %3
  %18 = load ptr, ptr %5, align 8, !tbaa !5
  %19 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK7Vector3ixEj(ptr noundef nonnull align 4 dereferenceable(12) %18, i32 noundef 0)
  %20 = load float, ptr %19, align 4, !tbaa !9
  %21 = load ptr, ptr %4, align 8, !tbaa !5
  %22 = getelementptr inbounds %"struct.geometry::types::aabb_t", ptr %21, i32 0, i32 0
  %23 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK7Vector3ixEj(ptr noundef nonnull align 4 dereferenceable(12) %22, i32 noundef 0)
  %24 = load float, ptr %23, align 4, !tbaa !9
  %25 = load float, ptr %6, align 4, !tbaa !9
  %26 = fadd float %24, %25
  %27 = fcmp ole float %20, %26
  br i1 %27, label %28, label %74

28:                                               ; preds = %17
  %29 = load ptr, ptr %5, align 8, !tbaa !5
  %30 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK7Vector3ixEj(ptr noundef nonnull align 4 dereferenceable(12) %29, i32 noundef 1)
  %31 = load float, ptr %30, align 4, !tbaa !9
  %32 = load ptr, ptr %4, align 8, !tbaa !5
  %33 = getelementptr inbounds %"struct.geometry::types::aabb_t", ptr %32, i32 0, i32 1
  %34 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK7Vector3ixEj(ptr noundef nonnull align 4 dereferenceable(12) %33, i32 noundef 1)
  %35 = load float, ptr %34, align 4, !tbaa !9
  %36 = load float, ptr %6, align 4, !tbaa !9
  %37 = fsub float %35, %36
  %38 = fcmp oge float %31, %37
  br i1 %38, label %39, label %74

39:                                               ; preds = %28
  %40 = load ptr, ptr %5, align 8, !tbaa !5
  %41 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK7Vector3ixEj(ptr noundef nonnull align 4 dereferenceable(12) %40, i32 noundef 1)
  %42 = load float, ptr %41, align 4, !tbaa !9
  %43 = load ptr, ptr %4, align 8, !tbaa !5
  %44 = getelementptr inbounds %"struct.geometry::types::aabb_t", ptr %43, i32 0, i32 0
  %45 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK7Vector3ixEj(ptr noundef nonnull align 4 dereferenceable(12) %44, i32 noundef 1)
  %46 = load float, ptr %45, align 4, !tbaa !9
  %47 = load float, ptr %6, align 4, !tbaa !9
  %48 = fadd float %46, %47
  %49 = fcmp ole float %42, %48
  br i1 %49, label %50, label %74

50:                                               ; preds = %39
  %51 = load ptr, ptr %5, align 8, !tbaa !5
  %52 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK7Vector3ixEj(ptr noundef nonnull align 4 dereferenceable(12) %51, i32 noundef 2)
  %53 = load float, ptr %52, align 4, !tbaa !9
  %54 = load ptr, ptr %4, align 8, !tbaa !5
  %55 = getelementptr inbounds %"struct.geometry::types::aabb_t", ptr %54, i32 0, i32 1
  %56 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK7Vector3ixEj(ptr noundef nonnull align 4 dereferenceable(12) %55, i32 noundef 2)
  %57 = load float, ptr %56, align 4, !tbaa !9
  %58 = load float, ptr %6, align 4, !tbaa !9
  %59 = fsub float %57, %58
  %60 = fcmp oge float %53, %59
  br i1 %60, label %61, label %72

61:                                               ; preds = %50
  %62 = load ptr, ptr %5, align 8, !tbaa !5
  %63 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK7Vector3ixEj(ptr noundef nonnull align 4 dereferenceable(12) %62, i32 noundef 2)
  %64 = load float, ptr %63, align 4, !tbaa !9
  %65 = load ptr, ptr %4, align 8, !tbaa !5
  %66 = getelementptr inbounds %"struct.geometry::types::aabb_t", ptr %65, i32 0, i32 0
  %67 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK7Vector3ixEj(ptr noundef nonnull align 4 dereferenceable(12) %66, i32 noundef 2)
  %68 = load float, ptr %67, align 4, !tbaa !9
  %69 = load float, ptr %6, align 4, !tbaa !9
  %70 = fadd float %68, %69
  %71 = fcmp ole float %64, %70
  br label %72

72:                                               ; preds = %61, %50
  %73 = phi i1 [ false, %50 ], [ %71, %61 ]
  br label %74

74:                                               ; preds = %72, %39, %28, %17, %3
  %75 = phi i1 [ false, %39 ], [ false, %28 ], [ false, %17 ], [ false, %3 ], [ %73, %72 ]
  ret i1 %75
}

attributes #0 = { 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 #1 = { 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" }

!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}


; 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: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZNK7Vector3ixEj(ptr noundef nonnull align 4 dereferenceable(12), i32 noundef) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef zeroext i1 @_ZN8geometry4mesh15pointInsideAabbERKNS_5types6aabb_tERK7Vector3f(ptr noundef nonnull align 4 dereferenceable(24) %0, ptr noundef nonnull align 4 dereferenceable(12) %1, float noundef %2) local_unnamed_addr #0 {
  %4 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK7Vector3ixEj(ptr noundef nonnull align 4 dereferenceable(12) %1, i32 noundef 0)
  %5 = load float, ptr %4, align 4, !tbaa !5
  %6 = getelementptr inbounds i8, ptr %0, i64 12
  %7 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK7Vector3ixEj(ptr noundef nonnull align 4 dereferenceable(12) %6, i32 noundef 0)
  %8 = load float, ptr %7, align 4, !tbaa !5
  %9 = fsub float %8, %2
  %10 = fcmp ult float %5, %9
  br i1 %10, label %46, label %11

11:                                               ; preds = %3
  %12 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK7Vector3ixEj(ptr noundef nonnull align 4 dereferenceable(12) %1, i32 noundef 0)
  %13 = load float, ptr %12, align 4, !tbaa !5
  %14 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK7Vector3ixEj(ptr noundef nonnull align 4 dereferenceable(12) %0, i32 noundef 0)
  %15 = load float, ptr %14, align 4, !tbaa !5
  %16 = fadd float %15, %2
  %17 = fcmp ugt float %13, %16
  br i1 %17, label %46, label %18

18:                                               ; preds = %11
  %19 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK7Vector3ixEj(ptr noundef nonnull align 4 dereferenceable(12) %1, i32 noundef 1)
  %20 = load float, ptr %19, align 4, !tbaa !5
  %21 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK7Vector3ixEj(ptr noundef nonnull align 4 dereferenceable(12) %6, i32 noundef 1)
  %22 = load float, ptr %21, align 4, !tbaa !5
  %23 = fsub float %22, %2
  %24 = fcmp ult float %20, %23
  br i1 %24, label %46, label %25

25:                                               ; preds = %18
  %26 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK7Vector3ixEj(ptr noundef nonnull align 4 dereferenceable(12) %1, i32 noundef 1)
  %27 = load float, ptr %26, align 4, !tbaa !5
  %28 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK7Vector3ixEj(ptr noundef nonnull align 4 dereferenceable(12) %0, i32 noundef 1)
  %29 = load float, ptr %28, align 4, !tbaa !5
  %30 = fadd float %29, %2
  %31 = fcmp ugt float %27, %30
  br i1 %31, label %46, label %32

32:                                               ; preds = %25
  %33 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK7Vector3ixEj(ptr noundef nonnull align 4 dereferenceable(12) %1, i32 noundef 2)
  %34 = load float, ptr %33, align 4, !tbaa !5
  %35 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK7Vector3ixEj(ptr noundef nonnull align 4 dereferenceable(12) %6, i32 noundef 2)
  %36 = load float, ptr %35, align 4, !tbaa !5
  %37 = fsub float %36, %2
  %38 = fcmp ult float %34, %37
  br i1 %38, label %46, label %39

39:                                               ; preds = %32
  %40 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK7Vector3ixEj(ptr noundef nonnull align 4 dereferenceable(12) %1, i32 noundef 2)
  %41 = load float, ptr %40, align 4, !tbaa !5
  %42 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK7Vector3ixEj(ptr noundef nonnull align 4 dereferenceable(12) %0, i32 noundef 2)
  %43 = load float, ptr %42, align 4, !tbaa !5
  %44 = fadd float %43, %2
  %45 = fcmp ole float %41, %44
  br label %46

46:                                               ; preds = %32, %39, %25, %18, %11, %3
  %47 = phi i1 [ false, %25 ], [ false, %18 ], [ false, %11 ], [ false, %3 ], [ false, %32 ], [ %45, %39 ]
  ret i1 %47
}

attributes #0 = { 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" }

!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,GlobalOptPass,InstCombinePass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass