; LLVM IR from jrouwe/JoltPhysics :: Jolt/Physics/Collision/Shape (HeightFieldShape)

; 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.JPH::Vec3" = type { %union.anon.3 }
%union.anon.3 = type { <4 x float> }
%"class.JPH::Mat44" = type { [4 x %"class.JPH::Vec4"] }
%"class.JPH::Vec4" = type { %union.anon.29 }
%union.anon.29 = type { <4 x 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: 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: mustprogress uwtable
declare dso_local { double, double } @_ZNK3JPH16HeightFieldShape11GetPositionEjj(ptr noundef nonnull align 16 dereferenceable(176), i32 noundef, i32 noundef) #2 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZNK3JPH16HeightFieldShape16DecodeSubShapeIDERKNS_10SubShapeIDERjS4_S4_(ptr noundef nonnull align 16 dereferenceable(176), ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #3 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK3JPH16HeightFieldShape17GetSupportingFaceERKNS_10SubShapeIDENS_4Vec3ES4_RKNS_5Mat44ERNS_11StaticArrayIS4_Lj32EEE(ptr noundef nonnull align 16 dereferenceable(176) %0, ptr noundef nonnull align 4 dereferenceable(4) %1, double %2, double %3, double %4, double %5, ptr noundef nonnull align 16 dereferenceable(64) %6, ptr noundef nonnull align 16 dereferenceable(528) %7) unnamed_addr #2 align 2 {
  %9 = alloca %"class.JPH::Vec3", align 16
  %10 = alloca %"class.JPH::Vec3", align 16
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca %"class.JPH::Vec3", align 16
  %19 = alloca %"class.JPH::Vec3", align 16
  %20 = alloca %"class.JPH::Vec3", align 16
  %21 = alloca %"class.JPH::Vec3", align 16
  %22 = alloca %"class.JPH::Vec3", align 16
  %23 = alloca %"class.JPH::Mat44", align 16
  %24 = alloca %"class.JPH::Vec3", align 16
  %25 = alloca ptr, align 8
  %26 = alloca ptr, align 8
  %27 = alloca ptr, align 8
  %28 = alloca ptr, align 8
  %29 = alloca %"class.JPH::Vec3", align 16
  %30 = alloca %"class.JPH::Vec3", align 16
  %31 = getelementptr inbounds { double, double }, ptr %9, i32 0, i32 0
  store double %2, ptr %31, align 16
  %32 = getelementptr inbounds { double, double }, ptr %9, i32 0, i32 1
  store double %3, ptr %32, align 8
  %33 = getelementptr inbounds { double, double }, ptr %10, i32 0, i32 0
  store double %4, ptr %33, align 16
  %34 = getelementptr inbounds { double, double }, ptr %10, i32 0, i32 1
  store double %5, ptr %34, align 8
  store ptr %0, ptr %11, align 8, !tbaa !5
  store ptr %1, ptr %12, align 8, !tbaa !5
  store ptr %6, ptr %13, align 8, !tbaa !5
  store ptr %7, ptr %14, align 8, !tbaa !5
  %35 = load ptr, ptr %11, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #8
  %36 = load ptr, ptr %12, align 8, !tbaa !5
  call void @_ZNK3JPH16HeightFieldShape16DecodeSubShapeIDERKNS_10SubShapeIDERjS4_S4_(ptr noundef nonnull align 16 dereferenceable(176) %35, ptr noundef nonnull align 4 dereferenceable(4) %36, ptr noundef nonnull align 4 dereferenceable(4) %15, ptr noundef nonnull align 4 dereferenceable(4) %16, ptr noundef nonnull align 4 dereferenceable(4) %17)
  %37 = load ptr, ptr %14, align 8, !tbaa !5
  call void @_ZN3JPH11StaticArrayINS_4Vec3ELj32EE6resizeEj(ptr noundef nonnull align 16 dereferenceable(528) %37, i32 noundef 3)
  call void @llvm.lifetime.start.p0(i64 16, ptr %18) #8
  %38 = load i32, ptr %15, align 4, !tbaa !9
  %39 = load i32, ptr %16, align 4, !tbaa !9
  %40 = call { double, double } @_ZNK3JPH16HeightFieldShape11GetPositionEjj(ptr noundef nonnull align 16 dereferenceable(176) %35, i32 noundef %38, i32 noundef %39)
  %41 = getelementptr inbounds %"class.JPH::Vec3", ptr %18, i32 0, i32 0
  %42 = getelementptr inbounds %union.anon.3, ptr %41, i32 0, i32 0
  %43 = getelementptr inbounds { double, double }, ptr %42, i32 0, i32 0
  %44 = extractvalue { double, double } %40, 0
  store double %44, ptr %43, align 16
  %45 = getelementptr inbounds { double, double }, ptr %42, i32 0, i32 1
  %46 = extractvalue { double, double } %40, 1
  store double %46, ptr %45, align 8
  %47 = load ptr, ptr %14, align 8, !tbaa !5
  %48 = call noundef nonnull align 16 dereferenceable(16) ptr @_ZN3JPH11StaticArrayINS_4Vec3ELj32EEixEj(ptr noundef nonnull align 16 dereferenceable(528) %47, i32 noundef 0)
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %48, ptr align 16 %18, i64 16, i1 false), !tbaa.struct !11
  call void @llvm.lifetime.end.p0(i64 16, ptr %18) #8
  call void @llvm.lifetime.start.p0(i64 16, ptr %19) #8
  %49 = load i32, ptr %15, align 4, !tbaa !9
  %50 = add i32 %49, 1
  %51 = load i32, ptr %16, align 4, !tbaa !9
  %52 = add i32 %51, 1
  %53 = call { double, double } @_ZNK3JPH16HeightFieldShape11GetPositionEjj(ptr noundef nonnull align 16 dereferenceable(176) %35, i32 noundef %50, i32 noundef %52)
  %54 = getelementptr inbounds %"class.JPH::Vec3", ptr %19, i32 0, i32 0
  %55 = getelementptr inbounds %union.anon.3, ptr %54, i32 0, i32 0
  %56 = getelementptr inbounds { double, double }, ptr %55, i32 0, i32 0
  %57 = extractvalue { double, double } %53, 0
  store double %57, ptr %56, align 16
  %58 = getelementptr inbounds { double, double }, ptr %55, i32 0, i32 1
  %59 = extractvalue { double, double } %53, 1
  store double %59, ptr %58, align 8
  %60 = load i32, ptr %17, align 4, !tbaa !9
  %61 = icmp eq i32 %60, 0
  br i1 %61, label %62, label %77

62:                                               ; preds = %8
  call void @llvm.lifetime.start.p0(i64 16, ptr %20) #8
  %63 = load i32, ptr %15, align 4, !tbaa !9
  %64 = load i32, ptr %16, align 4, !tbaa !9
  %65 = add i32 %64, 1
  %66 = call { double, double } @_ZNK3JPH16HeightFieldShape11GetPositionEjj(ptr noundef nonnull align 16 dereferenceable(176) %35, i32 noundef %63, i32 noundef %65)
  %67 = getelementptr inbounds %"class.JPH::Vec3", ptr %20, i32 0, i32 0
  %68 = getelementptr inbounds %union.anon.3, ptr %67, i32 0, i32 0
  %69 = getelementptr inbounds { double, double }, ptr %68, i32 0, i32 0
  %70 = extractvalue { double, double } %66, 0
  store double %70, ptr %69, align 16
  %71 = getelementptr inbounds { double, double }, ptr %68, i32 0, i32 1
  %72 = extractvalue { double, double } %66, 1
  store double %72, ptr %71, align 8
  %73 = load ptr, ptr %14, align 8, !tbaa !5
  %74 = call noundef nonnull align 16 dereferenceable(16) ptr @_ZN3JPH11StaticArrayINS_4Vec3ELj32EEixEj(ptr noundef nonnull align 16 dereferenceable(528) %73, i32 noundef 1)
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %74, ptr align 16 %20, i64 16, i1 false), !tbaa.struct !11
  call void @llvm.lifetime.end.p0(i64 16, ptr %20) #8
  %75 = load ptr, ptr %14, align 8, !tbaa !5
  %76 = call noundef nonnull align 16 dereferenceable(16) ptr @_ZN3JPH11StaticArrayINS_4Vec3ELj32EEixEj(ptr noundef nonnull align 16 dereferenceable(528) %75, i32 noundef 2)
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %76, ptr align 16 %19, i64 16, i1 false), !tbaa.struct !11
  br label %92

77:                                               ; preds = %8
  %78 = load ptr, ptr %14, align 8, !tbaa !5
  %79 = call noundef nonnull align 16 dereferenceable(16) ptr @_ZN3JPH11StaticArrayINS_4Vec3ELj32EEixEj(ptr noundef nonnull align 16 dereferenceable(528) %78, i32 noundef 1)
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %79, ptr align 16 %19, i64 16, i1 false), !tbaa.struct !11
  call void @llvm.lifetime.start.p0(i64 16, ptr %21) #8
  %80 = load i32, ptr %15, align 4, !tbaa !9
  %81 = add i32 %80, 1
  %82 = load i32, ptr %16, align 4, !tbaa !9
  %83 = call { double, double } @_ZNK3JPH16HeightFieldShape11GetPositionEjj(ptr noundef nonnull align 16 dereferenceable(176) %35, i32 noundef %81, i32 noundef %82)
  %84 = getelementptr inbounds %"class.JPH::Vec3", ptr %21, i32 0, i32 0
  %85 = getelementptr inbounds %union.anon.3, ptr %84, i32 0, i32 0
  %86 = getelementptr inbounds { double, double }, ptr %85, i32 0, i32 0
  %87 = extractvalue { double, double } %83, 0
  store double %87, ptr %86, align 16
  %88 = getelementptr inbounds { double, double }, ptr %85, i32 0, i32 1
  %89 = extractvalue { double, double } %83, 1
  store double %89, ptr %88, align 8
  %90 = load ptr, ptr %14, align 8, !tbaa !5
  %91 = call noundef nonnull align 16 dereferenceable(16) ptr @_ZN3JPH11StaticArrayINS_4Vec3ELj32EEixEj(ptr noundef nonnull align 16 dereferenceable(528) %90, i32 noundef 2)
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %91, ptr align 16 %21, i64 16, i1 false), !tbaa.struct !11
  call void @llvm.lifetime.end.p0(i64 16, ptr %21) #8
  br label %92

92:                                               ; preds = %77, %62
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %22, ptr align 16 %10, i64 16, i1 false), !tbaa.struct !11
  %93 = getelementptr inbounds { double, double }, ptr %22, i32 0, i32 0
  %94 = load double, ptr %93, align 16
  %95 = getelementptr inbounds { double, double }, ptr %22, i32 0, i32 1
  %96 = load double, ptr %95, align 8
  %97 = call noundef zeroext i1 @_ZN3JPH12ScaleHelpers11IsInsideOutENS_4Vec3E(double %94, double %96)
  br i1 %97, label %98, label %103

98:                                               ; preds = %92
  %99 = load ptr, ptr %14, align 8, !tbaa !5
  %100 = call noundef nonnull align 16 dereferenceable(16) ptr @_ZN3JPH11StaticArrayINS_4Vec3ELj32EEixEj(ptr noundef nonnull align 16 dereferenceable(528) %99, i32 noundef 1)
  %101 = load ptr, ptr %14, align 8, !tbaa !5
  %102 = call noundef nonnull align 16 dereferenceable(16) ptr @_ZN3JPH11StaticArrayINS_4Vec3ELj32EEixEj(ptr noundef nonnull align 16 dereferenceable(528) %101, i32 noundef 2)
  call void @_ZSt4swapIN3JPH4Vec3EENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS5_ESt18is_move_assignableIS5_EEE5valueEvE4typeERS5_SE_(ptr noundef nonnull align 16 dereferenceable(16) %100, ptr noundef nonnull align 16 dereferenceable(16) %102) #8
  br label %103

103:                                              ; preds = %98, %92
  call void @llvm.lifetime.start.p0(i64 64, ptr %23) #8
  %104 = load ptr, ptr %13, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %24, ptr align 16 %10, i64 16, i1 false), !tbaa.struct !11
  %105 = getelementptr inbounds { double, double }, ptr %24, i32 0, i32 0
  %106 = load double, ptr %105, align 16
  %107 = getelementptr inbounds { double, double }, ptr %24, i32 0, i32 1
  %108 = load double, ptr %107, align 8
  call void @_ZNK3JPH5Mat449PreScaledENS_4Vec3E(ptr dead_on_unwind writable sret(%"class.JPH::Mat44") align 16 %23, ptr noundef nonnull align 16 dereferenceable(64) %104, double %106, double %108)
  call void @llvm.lifetime.start.p0(i64 8, ptr %25) #8
  %109 = load ptr, ptr %14, align 8, !tbaa !5
  store ptr %109, ptr %25, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %26) #8
  %110 = load ptr, ptr %25, align 8, !tbaa !5
  %111 = call noundef ptr @_ZN3JPH11StaticArrayINS_4Vec3ELj32EE5beginEv(ptr noundef nonnull align 16 dereferenceable(528) %110)
  store ptr %111, ptr %26, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %27) #8
  %112 = load ptr, ptr %25, align 8, !tbaa !5
  %113 = call noundef ptr @_ZN3JPH11StaticArrayINS_4Vec3ELj32EE3endEv(ptr noundef nonnull align 16 dereferenceable(528) %112)
  store ptr %113, ptr %27, align 8, !tbaa !5
  br label %114

114:                                              ; preds = %134, %103
  %115 = load ptr, ptr %26, align 8, !tbaa !5
  %116 = load ptr, ptr %27, align 8, !tbaa !5
  %117 = icmp ne ptr %115, %116
  br i1 %117, label %119, label %118

118:                                              ; preds = %114
  call void @llvm.lifetime.end.p0(i64 8, ptr %27) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %26) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #8
  br label %137

119:                                              ; preds = %114
  call void @llvm.lifetime.start.p0(i64 8, ptr %28) #8
  %120 = load ptr, ptr %26, align 8, !tbaa !5
  store ptr %120, ptr %28, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr %29) #8
  %121 = load ptr, ptr %28, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %30, ptr align 16 %121, i64 16, i1 false), !tbaa.struct !11
  %122 = getelementptr inbounds { double, double }, ptr %30, i32 0, i32 0
  %123 = load double, ptr %122, align 16
  %124 = getelementptr inbounds { double, double }, ptr %30, i32 0, i32 1
  %125 = load double, ptr %124, align 8
  %126 = call { double, double } @_ZNK3JPH5Mat44mlENS_4Vec3E(ptr noundef nonnull align 16 dereferenceable(64) %23, double %123, double %125)
  %127 = getelementptr inbounds %"class.JPH::Vec3", ptr %29, i32 0, i32 0
  %128 = getelementptr inbounds %union.anon.3, ptr %127, i32 0, i32 0
  %129 = getelementptr inbounds { double, double }, ptr %128, i32 0, i32 0
  %130 = extractvalue { double, double } %126, 0
  store double %130, ptr %129, align 16
  %131 = getelementptr inbounds { double, double }, ptr %128, i32 0, i32 1
  %132 = extractvalue { double, double } %126, 1
  store double %132, ptr %131, align 8
  %133 = load ptr, ptr %28, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %133, ptr align 16 %29, i64 16, i1 false), !tbaa.struct !11
  call void @llvm.lifetime.end.p0(i64 16, ptr %29) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %28) #8
  br label %134

134:                                              ; preds = %119
  %135 = load ptr, ptr %26, align 8, !tbaa !5
  %136 = getelementptr inbounds %"class.JPH::Vec3", ptr %135, i32 1
  store ptr %136, ptr %26, align 8, !tbaa !5
  br label %114

137:                                              ; preds = %118
  call void @llvm.lifetime.end.p0(i64 64, ptr %23) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr %19) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #8
  ret void
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3JPH11StaticArrayINS_4Vec3ELj32EE6resizeEj(ptr noundef nonnull align 16 dereferenceable(528), i32 noundef) #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 16 dereferenceable(16) ptr @_ZN3JPH11StaticArrayINS_4Vec3ELj32EEixEj(ptr noundef nonnull align 16 dereferenceable(528), i32 noundef) #2 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN3JPH12ScaleHelpers11IsInsideOutENS_4Vec3E(double, double) #3

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZSt4swapIN3JPH4Vec3EENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS5_ESt18is_move_assignableIS5_EEE5valueEvE4typeERS5_SE_(ptr noundef nonnull align 16 dereferenceable(16), ptr noundef nonnull align 16 dereferenceable(16)) #4

; Function Attrs: alwaysinline mustprogress uwtable
declare dso_local void @_ZNK3JPH5Mat449PreScaledENS_4Vec3E(ptr dead_on_unwind noalias writable sret(%"class.JPH::Mat44") align 16, ptr noundef nonnull align 16 dereferenceable(64), double, double) #5 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN3JPH11StaticArrayINS_4Vec3ELj32EE5beginEv(ptr noundef nonnull align 16 dereferenceable(528)) #6 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN3JPH11StaticArrayINS_4Vec3ELj32EE3endEv(ptr noundef nonnull align 16 dereferenceable(528)) #6 align 2

; Function Attrs: alwaysinline mustprogress uwtable
declare dso_local { double, double } @_ZNK3JPH5Mat44mlENS_4Vec3E(ptr noundef nonnull align 16 dereferenceable(64), double, double) #7 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"="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 = { inlinehint 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 #4 = { 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 #5 = { alwaysinline 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 #6 = { 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 #7 = { alwaysinline mustprogress uwtable "min-legal-vector-width"="128" "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 #8 = { 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 = !{!"int", !7, i64 0}
!11 = !{i64 0, i64 16, !12}
!12 = !{!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.JPH::Mat44" = type { [4 x %"class.JPH::Vec4"] }
%"class.JPH::Vec4" = type { %union.anon.29 }
%union.anon.29 = 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

; Function Attrs: mustprogress uwtable
declare dso_local { double, double } @_ZNK3JPH16HeightFieldShape11GetPositionEjj(ptr noundef nonnull align 16 dereferenceable(176), i32 noundef, i32 noundef) local_unnamed_addr #1 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZNK3JPH16HeightFieldShape16DecodeSubShapeIDERKNS_10SubShapeIDERjS4_S4_(ptr noundef nonnull align 16 dereferenceable(176), ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK3JPH16HeightFieldShape17GetSupportingFaceERKNS_10SubShapeIDENS_4Vec3ES4_RKNS_5Mat44ERNS_11StaticArrayIS4_Lj32EEE(ptr noundef nonnull align 16 dereferenceable(176) %0, ptr noundef nonnull align 4 dereferenceable(4) %1, double %2, double %3, double %4, double %5, ptr noundef nonnull align 16 dereferenceable(64) %6, ptr noundef nonnull align 16 dereferenceable(528) %7) unnamed_addr #1 align 2 {
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca %"class.JPH::Mat44", align 16
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %9) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %10) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %11) #7
  call void @_ZNK3JPH16HeightFieldShape16DecodeSubShapeIDERKNS_10SubShapeIDERjS4_S4_(ptr noundef nonnull align 16 dereferenceable(176) %0, ptr noundef nonnull align 4 dereferenceable(4) %1, ptr noundef nonnull align 4 dereferenceable(4) %9, ptr noundef nonnull align 4 dereferenceable(4) %10, ptr noundef nonnull align 4 dereferenceable(4) %11)
  call void @_ZN3JPH11StaticArrayINS_4Vec3ELj32EE6resizeEj(ptr noundef nonnull align 16 dereferenceable(528) %7, i32 noundef 3)
  %13 = load i32, ptr %9, align 4, !tbaa !5
  %14 = load i32, ptr %10, align 4, !tbaa !5
  %15 = call { double, double } @_ZNK3JPH16HeightFieldShape11GetPositionEjj(ptr noundef nonnull align 16 dereferenceable(176) %0, i32 noundef %13, i32 noundef %14)
  %16 = extractvalue { double, double } %15, 0
  %17 = extractvalue { double, double } %15, 1
  %18 = call noundef nonnull align 16 dereferenceable(16) ptr @_ZN3JPH11StaticArrayINS_4Vec3ELj32EEixEj(ptr noundef nonnull align 16 dereferenceable(528) %7, i32 noundef 0)
  store double %16, ptr %18, align 16
  %.sroa.422.0..sroa_idx = getelementptr inbounds i8, ptr %18, i64 8
  store double %17, ptr %.sroa.422.0..sroa_idx, align 8, !tbaa !9
  %19 = load i32, ptr %9, align 4, !tbaa !5
  %20 = add i32 %19, 1
  %21 = load i32, ptr %10, align 4, !tbaa !5
  %22 = add i32 %21, 1
  %23 = call { double, double } @_ZNK3JPH16HeightFieldShape11GetPositionEjj(ptr noundef nonnull align 16 dereferenceable(176) %0, i32 noundef %20, i32 noundef %22)
  %24 = extractvalue { double, double } %23, 0
  %25 = extractvalue { double, double } %23, 1
  %26 = load i32, ptr %11, align 4, !tbaa !5
  %27 = icmp eq i32 %26, 0
  br i1 %27, label %28, label %36

28:                                               ; preds = %8
  %29 = load i32, ptr %9, align 4, !tbaa !5
  %30 = load i32, ptr %10, align 4, !tbaa !5
  %31 = add i32 %30, 1
  %32 = call { double, double } @_ZNK3JPH16HeightFieldShape11GetPositionEjj(ptr noundef nonnull align 16 dereferenceable(176) %0, i32 noundef %29, i32 noundef %31)
  %33 = extractvalue { double, double } %32, 0
  %34 = extractvalue { double, double } %32, 1
  %35 = call noundef nonnull align 16 dereferenceable(16) ptr @_ZN3JPH11StaticArrayINS_4Vec3ELj32EEixEj(ptr noundef nonnull align 16 dereferenceable(528) %7, i32 noundef 1)
  store double %33, ptr %35, align 16
  %.sroa.416.0..sroa_idx = getelementptr inbounds i8, ptr %35, i64 8
  store double %34, ptr %.sroa.416.0..sroa_idx, align 8, !tbaa !9
  br label %44

36:                                               ; preds = %8
  %37 = call noundef nonnull align 16 dereferenceable(16) ptr @_ZN3JPH11StaticArrayINS_4Vec3ELj32EEixEj(ptr noundef nonnull align 16 dereferenceable(528) %7, i32 noundef 1)
  store double %24, ptr %37, align 16
  %.sroa.5.0..sroa_idx19 = getelementptr inbounds i8, ptr %37, i64 8
  store double %25, ptr %.sroa.5.0..sroa_idx19, align 8, !tbaa !9
  %38 = load i32, ptr %9, align 4, !tbaa !5
  %39 = add i32 %38, 1
  %40 = load i32, ptr %10, align 4, !tbaa !5
  %41 = call { double, double } @_ZNK3JPH16HeightFieldShape11GetPositionEjj(ptr noundef nonnull align 16 dereferenceable(176) %0, i32 noundef %39, i32 noundef %40)
  %42 = extractvalue { double, double } %41, 0
  %43 = extractvalue { double, double } %41, 1
  br label %44

44:                                               ; preds = %36, %28
  %.sink40 = phi double [ %42, %36 ], [ %24, %28 ]
  %.sink = phi double [ %43, %36 ], [ %25, %28 ]
  %45 = call noundef nonnull align 16 dereferenceable(16) ptr @_ZN3JPH11StaticArrayINS_4Vec3ELj32EEixEj(ptr noundef nonnull align 16 dereferenceable(528) %7, i32 noundef 2)
  store double %.sink40, ptr %45, align 16
  %.sroa.414.0..sroa_idx = getelementptr inbounds i8, ptr %45, i64 8
  store double %.sink, ptr %.sroa.414.0..sroa_idx, align 8, !tbaa !9
  %46 = call noundef zeroext i1 @_ZN3JPH12ScaleHelpers11IsInsideOutENS_4Vec3E(double %4, double %5)
  br i1 %46, label %47, label %50

47:                                               ; preds = %44
  %48 = call noundef nonnull align 16 dereferenceable(16) ptr @_ZN3JPH11StaticArrayINS_4Vec3ELj32EEixEj(ptr noundef nonnull align 16 dereferenceable(528) %7, i32 noundef 1)
  %49 = call noundef nonnull align 16 dereferenceable(16) ptr @_ZN3JPH11StaticArrayINS_4Vec3ELj32EEixEj(ptr noundef nonnull align 16 dereferenceable(528) %7, i32 noundef 2)
  call void @_ZSt4swapIN3JPH4Vec3EENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS5_ESt18is_move_assignableIS5_EEE5valueEvE4typeERS5_SE_(ptr noundef nonnull align 16 dereferenceable(16) %48, ptr noundef nonnull align 16 dereferenceable(16) %49) #7
  br label %50

50:                                               ; preds = %47, %44
  call void @llvm.lifetime.start.p0(i64 64, ptr nonnull %12) #7
  call void @_ZNK3JPH5Mat449PreScaledENS_4Vec3E(ptr dead_on_unwind nonnull writable sret(%"class.JPH::Mat44") align 16 %12, ptr noundef nonnull align 16 dereferenceable(64) %6, double %4, double %5)
  %51 = call noundef ptr @_ZN3JPH11StaticArrayINS_4Vec3ELj32EE5beginEv(ptr noundef nonnull align 16 dereferenceable(528) %7)
  %52 = call noundef ptr @_ZN3JPH11StaticArrayINS_4Vec3ELj32EE3endEv(ptr noundef nonnull align 16 dereferenceable(528) %7)
  %.not37 = icmp eq ptr %51, %52
  br i1 %.not37, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %.lr.ph, %50
  call void @llvm.lifetime.end.p0(i64 64, ptr nonnull %12) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %11) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %10) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %9) #7
  ret void

.lr.ph:                                           ; preds = %50, %.lr.ph
  %.038 = phi ptr [ %56, %.lr.ph ], [ %51, %50 ]
  %.sroa.0.0.copyload = load double, ptr %.038, align 16
  %.sroa.2.0..sroa_idx = getelementptr inbounds i8, ptr %.038, i64 8
  %.sroa.2.0.copyload = load double, ptr %.sroa.2.0..sroa_idx, align 8, !tbaa !9
  %53 = call { double, double } @_ZNK3JPH5Mat44mlENS_4Vec3E(ptr noundef nonnull align 16 dereferenceable(64) %12, double %.sroa.0.0.copyload, double %.sroa.2.0.copyload)
  %54 = extractvalue { double, double } %53, 0
  %55 = extractvalue { double, double } %53, 1
  store double %54, ptr %.038, align 16
  store double %55, ptr %.sroa.2.0..sroa_idx, align 8, !tbaa !9
  %56 = getelementptr inbounds i8, ptr %.038, i64 16
  %.not = icmp eq ptr %56, %52
  br i1 %.not, label %._crit_edge, label %.lr.ph
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3JPH11StaticArrayINS_4Vec3ELj32EE6resizeEj(ptr noundef nonnull align 16 dereferenceable(528), i32 noundef) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 16 dereferenceable(16) ptr @_ZN3JPH11StaticArrayINS_4Vec3ELj32EEixEj(ptr noundef nonnull align 16 dereferenceable(528), i32 noundef) local_unnamed_addr #1 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN3JPH12ScaleHelpers11IsInsideOutENS_4Vec3E(double, double) local_unnamed_addr #2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZSt4swapIN3JPH4Vec3EENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS5_ESt18is_move_assignableIS5_EEE5valueEvE4typeERS5_SE_(ptr noundef nonnull align 16 dereferenceable(16), ptr noundef nonnull align 16 dereferenceable(16)) local_unnamed_addr #3

; Function Attrs: alwaysinline mustprogress uwtable
declare dso_local void @_ZNK3JPH5Mat449PreScaledENS_4Vec3E(ptr dead_on_unwind noalias writable sret(%"class.JPH::Mat44") align 16, ptr noundef nonnull align 16 dereferenceable(64), double, double) local_unnamed_addr #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN3JPH11StaticArrayINS_4Vec3ELj32EE5beginEv(ptr noundef nonnull align 16 dereferenceable(528)) local_unnamed_addr #5 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN3JPH11StaticArrayINS_4Vec3ELj32EE3endEv(ptr noundef nonnull align 16 dereferenceable(528)) local_unnamed_addr #5 align 2

; Function Attrs: alwaysinline mustprogress uwtable
declare dso_local { double, double } @_ZNK3JPH5Mat44mlENS_4Vec3E(ptr noundef nonnull align 16 dereferenceable(64), double, double) local_unnamed_addr #6 align 2

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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" }
attributes #2 = { inlinehint 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 = { 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 #4 = { alwaysinline 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 #5 = { 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 #6 = { alwaysinline mustprogress uwtable "min-legal-vector-width"="128" "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 #7 = { 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!7, !7, i64 0}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass