; LLVM IR from jrouwe/JoltPhysics :: Jolt/Physics/Constraints/SliderConstraint.ll (ZN3JPH16SliderConstraint9SetLimitsEff)

; 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.JPH::AssertLastParam" = type { i8 }
%"class.JPH::SliderConstraint" = type { %"class.JPH::TwoBodyConstraint", %"class.JPH::Vec3", %"class.JPH::Vec3", %"class.JPH::Vec3", %"class.JPH::Vec3", %"class.JPH::Vec3", %"class.JPH::Quat", i8, float, float, %"class.JPH::SpringSettings", float, %"class.JPH::MotorSettings", i32, float, float, %"class.JPH::Vec3", %"class.JPH::Vec3", %"class.JPH::Vec3", %"class.JPH::Vec3", %"class.JPH::Vec3", %"class.JPH::Vec3", float, [12 x i8], %"class.JPH::DualAxisConstraintPart", %"class.JPH::RotationEulerConstraintPart", %"class.JPH::AxisConstraintPart", %"class.JPH::AxisConstraintPart" }
%"class.JPH::TwoBodyConstraint" = type { %"class.JPH::Constraint", ptr, ptr }
%"class.JPH::Constraint" = type { ptr, %"class.JPH::RefTarget.3", i32, i32, i8, i8, i8, i64 }
%"class.JPH::RefTarget.3" = type { %"struct.std::atomic" }
%"struct.std::atomic" = type { %"struct.std::__atomic_base" }
%"struct.std::__atomic_base" = type { i32 }
%"class.JPH::Quat" = type { %"class.JPH::Vec4" }
%"class.JPH::Vec4" = type { %union.anon.4 }
%union.anon.4 = type { <4 x float> }
%"class.JPH::SpringSettings" = type { i8, %union.anon.2, float }
%union.anon.2 = type { float }
%"class.JPH::MotorSettings" = type { %"class.JPH::SpringSettings", float, float, float, float }
%"class.JPH::Vec3" = type { %union.anon }
%union.anon = type { <4 x float> }
%"class.JPH::DualAxisConstraintPart" = type <{ %"class.JPH::Vec3", %"class.JPH::Vec3", %"class.JPH::Vec3", %"class.JPH::Vec3", %"class.JPH::Vec3", %"class.JPH::Vec3", %"class.JPH::Vec3", %"class.JPH::Vec3", %"class.JPH::Matrix", %"class.JPH::Vector", [8 x i8] }>
%"class.JPH::Matrix" = type { [2 x %"class.JPH::Vector"] }
%"class.JPH::Vector" = type { [2 x float] }
%"class.JPH::RotationEulerConstraintPart" = type { %"class.JPH::Mat44", %"class.JPH::Mat44", %"class.JPH::Mat44", %"class.JPH::Vec3" }
%"class.JPH::Mat44" = type { [4 x %"class.JPH::Vec4"] }
%"class.JPH::AxisConstraintPart" = type { %"class.JPH::Float3", %"class.JPH::Float3", %"class.JPH::Float3", %"class.JPH::Float3", float, %"class.JPH::SpringPart", float }
%"class.JPH::Float3" = type { float, float, float }
%"class.JPH::SpringPart" = type { float, float }

@.str.2 = external hidden unnamed_addr constant [98 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [20 x i8], align 1

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN3JPH23AssertFailedParamHelperEPKcS1_jNS_15AssertLastParamE(ptr noundef, ptr noundef, i32 noundef) #0

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3JPH16SliderConstraint9SetLimitsEff(ptr noundef nonnull align 16 dereferenceable(832) %0, float noundef %1, float noundef %2) #1 align 2 {
  %4 = alloca ptr, align 8
  %5 = alloca float, align 4
  %6 = alloca float, align 4
  %7 = alloca %"struct.JPH::AssertLastParam", align 1
  %8 = alloca %"struct.JPH::AssertLastParam", align 1
  store ptr %0, ptr %4, align 8, !tbaa !5
  store float %1, ptr %5, align 4, !tbaa !9
  store float %2, ptr %6, align 4, !tbaa !9
  %9 = load ptr, ptr %4, align 8
  br label %10

10:                                               ; preds = %3
  %11 = load float, ptr %5, align 4, !tbaa !9
  %12 = fcmp ole float %11, 0.000000e+00
  br i1 %12, label %16, label %13

13:                                               ; preds = %10
  %14 = call noundef zeroext i1 @_ZN3JPH23AssertFailedParamHelperEPKcS1_jNS_15AssertLastParamE(ptr noundef @.str.5, ptr noundef @.str.2, i32 noundef 185)
  br i1 %14, label %15, label %16

15:                                               ; preds = %13
  call void asm sideeffect "int $$0x3", "~{dirflag},~{fpsr},~{flags}"() #2, !srcloc !11
  br label %16

16:                                               ; preds = %15, %13, %10
  br label %17

17:                                               ; preds = %16
  br label %18

18:                                               ; preds = %17
  %19 = load float, ptr %6, align 4, !tbaa !9
  %20 = fcmp oge float %19, 0.000000e+00
  br i1 %20, label %24, label %21

21:                                               ; preds = %18
  %22 = call noundef zeroext i1 @_ZN3JPH23AssertFailedParamHelperEPKcS1_jNS_15AssertLastParamE(ptr noundef @.str.6, ptr noundef @.str.2, i32 noundef 186)
  br i1 %22, label %23, label %24

23:                                               ; preds = %21
  call void asm sideeffect "int $$0x3", "~{dirflag},~{fpsr},~{flags}"() #2, !srcloc !12
  br label %24

24:                                               ; preds = %23, %21, %18
  br label %25

25:                                               ; preds = %24
  %26 = load float, ptr %5, align 4, !tbaa !9
  %27 = getelementptr inbounds %"class.JPH::SliderConstraint", ptr %9, i32 0, i32 8
  store float %26, ptr %27, align 4, !tbaa !13
  %28 = load float, ptr %6, align 4, !tbaa !9
  %29 = getelementptr inbounds %"class.JPH::SliderConstraint", ptr %9, i32 0, i32 9
  store float %28, ptr %29, align 8, !tbaa !38
  %30 = getelementptr inbounds %"class.JPH::SliderConstraint", ptr %9, i32 0, i32 8
  %31 = load float, ptr %30, align 4, !tbaa !13
  %32 = fcmp une float %31, 0xC7EFFFFFE0000000
  br i1 %32, label %37, label %33

33:                                               ; preds = %25
  %34 = getelementptr inbounds %"class.JPH::SliderConstraint", ptr %9, i32 0, i32 9
  %35 = load float, ptr %34, align 8, !tbaa !38
  %36 = fcmp une float %35, 0x47EFFFFFE0000000
  br label %37

37:                                               ; preds = %33, %25
  %38 = phi i1 [ true, %25 ], [ %36, %33 ]
  %39 = getelementptr inbounds %"class.JPH::SliderConstraint", ptr %9, i32 0, i32 7
  %40 = zext i1 %38 to i8
  store i8 %40, ptr %39, align 16, !tbaa !39
  ret void
}

attributes #0 = { 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 #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 = { 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 = !{i64 2158334700}
!12 = !{i64 2158335044}
!13 = !{!14, !10, i64 148}
!14 = !{!"_ZTSN3JPH16SliderConstraintE", !15, i64 0, !23, i64 48, !23, i64 64, !23, i64 80, !23, i64 96, !23, i64 112, !24, i64 128, !21, i64 144, !10, i64 148, !10, i64 152, !26, i64 156, !10, i64 168, !28, i64 172, !29, i64 200, !10, i64 204, !10, i64 208, !23, i64 224, !23, i64 240, !23, i64 256, !23, i64 272, !23, i64 288, !23, i64 304, !10, i64 320, !30, i64 336, !33, i64 496, !35, i64 704, !35, i64 768}
!15 = !{!"_ZTSN3JPH17TwoBodyConstraintE", !16, i64 0, !6, i64 32, !6, i64 40}
!16 = !{!"_ZTSN3JPH10ConstraintE", !17, i64 8, !20, i64 12, !20, i64 16, !7, i64 20, !7, i64 21, !21, i64 22, !22, i64 24}
!17 = !{!"_ZTSN3JPH9RefTargetINS_10ConstraintEEE", !18, i64 0}
!18 = !{!"_ZTSSt6atomicIjE", !19, i64 0}
!19 = !{!"_ZTSSt13__atomic_baseIjE", !20, i64 0}
!20 = !{!"int", !7, i64 0}
!21 = !{!"bool", !7, i64 0}
!22 = !{!"long", !7, i64 0}
!23 = !{!"_ZTSN3JPH4Vec3E", !7, i64 0}
!24 = !{!"_ZTSN3JPH4QuatE", !25, i64 0}
!25 = !{!"_ZTSN3JPH4Vec4E", !7, i64 0}
!26 = !{!"_ZTSN3JPH14SpringSettingsE", !27, i64 0, !7, i64 4, !10, i64 8}
!27 = !{!"_ZTSN3JPH11ESpringModeE", !7, i64 0}
!28 = !{!"_ZTSN3JPH13MotorSettingsE", !26, i64 0, !10, i64 12, !10, i64 16, !10, i64 20, !10, i64 24}
!29 = !{!"_ZTSN3JPH11EMotorStateE", !7, i64 0}
!30 = !{!"_ZTSN3JPH22DualAxisConstraintPartE", !23, i64 0, !23, i64 16, !23, i64 32, !23, i64 48, !23, i64 64, !23, i64 80, !23, i64 96, !23, i64 112, !31, i64 128, !32, i64 144}
!31 = !{!"_ZTSN3JPH6MatrixILj2ELj2EEE", !7, i64 0}
!32 = !{!"_ZTSN3JPH6VectorILj2EEE", !7, i64 0}
!33 = !{!"_ZTSN3JPH27RotationEulerConstraintPartE", !34, i64 0, !34, i64 64, !34, i64 128, !23, i64 192}
!34 = !{!"_ZTSN3JPH5Mat44E", !7, i64 0}
!35 = !{!"_ZTSN3JPH18AxisConstraintPartE", !36, i64 0, !36, i64 12, !36, i64 24, !36, i64 36, !10, i64 48, !37, i64 52, !10, i64 60}
!36 = !{!"_ZTSN3JPH6Float3E", !10, i64 0, !10, i64 4, !10, i64 8}
!37 = !{!"_ZTSN3JPH10SpringPartE", !10, i64 0, !10, i64 4}
!38 = !{!14, !10, i64 152}
!39 = !{!14, !21, i64 144}


; 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"

@.str.2 = external hidden unnamed_addr constant [98 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [20 x i8], align 1

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN3JPH23AssertFailedParamHelperEPKcS1_jNS_15AssertLastParamE(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3JPH16SliderConstraint9SetLimitsEff(ptr nocapture noundef nonnull writeonly align 16 dereferenceable(832) %0, float noundef %1, float noundef %2) local_unnamed_addr #1 align 2 {
  %4 = fcmp ugt float %1, 0.000000e+00
  br i1 %4, label %5, label %8

5:                                                ; preds = %3
  %6 = tail call noundef zeroext i1 @_ZN3JPH23AssertFailedParamHelperEPKcS1_jNS_15AssertLastParamE(ptr noundef nonnull @.str.5, ptr noundef nonnull @.str.2, i32 noundef 185)
  br i1 %6, label %7, label %8

7:                                                ; preds = %5
  tail call void asm sideeffect "int $$0x3", "~{dirflag},~{fpsr},~{flags}"() #2, !srcloc !5
  br label %8

8:                                                ; preds = %7, %5, %3
  %9 = fcmp ult float %2, 0.000000e+00
  br i1 %9, label %10, label %13

10:                                               ; preds = %8
  %11 = tail call noundef zeroext i1 @_ZN3JPH23AssertFailedParamHelperEPKcS1_jNS_15AssertLastParamE(ptr noundef nonnull @.str.6, ptr noundef nonnull @.str.2, i32 noundef 186)
  br i1 %11, label %12, label %13

12:                                               ; preds = %10
  tail call void asm sideeffect "int $$0x3", "~{dirflag},~{fpsr},~{flags}"() #2, !srcloc !6
  br label %13

13:                                               ; preds = %8, %10, %12
  %14 = getelementptr inbounds i8, ptr %0, i64 148
  store float %1, ptr %14, align 4, !tbaa !7
  %15 = getelementptr inbounds i8, ptr %0, i64 152
  store float %2, ptr %15, align 8, !tbaa !36
  %16 = fcmp une float %1, 0xC7EFFFFFE0000000
  %17 = fcmp une float %2, 0x47EFFFFFE0000000
  %narrow = or i1 %16, %17
  %18 = zext i1 %narrow to i8
  %19 = getelementptr inbounds i8, ptr %0, i64 144
  store i8 %18, ptr %19, align 16, !tbaa !37
  ret void
}

attributes #0 = { 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 #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 = { 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 = !{i64 2158334700}
!6 = !{i64 2158335044}
!7 = !{!8, !23, i64 148}
!8 = !{!"_ZTSN3JPH16SliderConstraintE", !9, i64 0, !20, i64 48, !20, i64 64, !20, i64 80, !20, i64 96, !20, i64 112, !21, i64 128, !17, i64 144, !23, i64 148, !23, i64 152, !24, i64 156, !23, i64 168, !26, i64 172, !27, i64 200, !23, i64 204, !23, i64 208, !20, i64 224, !20, i64 240, !20, i64 256, !20, i64 272, !20, i64 288, !20, i64 304, !23, i64 320, !28, i64 336, !31, i64 496, !33, i64 704, !33, i64 768}
!9 = !{!"_ZTSN3JPH17TwoBodyConstraintE", !10, i64 0, !19, i64 32, !19, i64 40}
!10 = !{!"_ZTSN3JPH10ConstraintE", !11, i64 8, !14, i64 12, !14, i64 16, !15, i64 20, !15, i64 21, !17, i64 22, !18, i64 24}
!11 = !{!"_ZTSN3JPH9RefTargetINS_10ConstraintEEE", !12, i64 0}
!12 = !{!"_ZTSSt6atomicIjE", !13, i64 0}
!13 = !{!"_ZTSSt13__atomic_baseIjE", !14, i64 0}
!14 = !{!"int", !15, i64 0}
!15 = !{!"omnipotent char", !16, i64 0}
!16 = !{!"Simple C++ TBAA"}
!17 = !{!"bool", !15, i64 0}
!18 = !{!"long", !15, i64 0}
!19 = !{!"any pointer", !15, i64 0}
!20 = !{!"_ZTSN3JPH4Vec3E", !15, i64 0}
!21 = !{!"_ZTSN3JPH4QuatE", !22, i64 0}
!22 = !{!"_ZTSN3JPH4Vec4E", !15, i64 0}
!23 = !{!"float", !15, i64 0}
!24 = !{!"_ZTSN3JPH14SpringSettingsE", !25, i64 0, !15, i64 4, !23, i64 8}
!25 = !{!"_ZTSN3JPH11ESpringModeE", !15, i64 0}
!26 = !{!"_ZTSN3JPH13MotorSettingsE", !24, i64 0, !23, i64 12, !23, i64 16, !23, i64 20, !23, i64 24}
!27 = !{!"_ZTSN3JPH11EMotorStateE", !15, i64 0}
!28 = !{!"_ZTSN3JPH22DualAxisConstraintPartE", !20, i64 0, !20, i64 16, !20, i64 32, !20, i64 48, !20, i64 64, !20, i64 80, !20, i64 96, !20, i64 112, !29, i64 128, !30, i64 144}
!29 = !{!"_ZTSN3JPH6MatrixILj2ELj2EEE", !15, i64 0}
!30 = !{!"_ZTSN3JPH6VectorILj2EEE", !15, i64 0}
!31 = !{!"_ZTSN3JPH27RotationEulerConstraintPartE", !32, i64 0, !32, i64 64, !32, i64 128, !20, i64 192}
!32 = !{!"_ZTSN3JPH5Mat44E", !15, i64 0}
!33 = !{!"_ZTSN3JPH18AxisConstraintPartE", !34, i64 0, !34, i64 12, !34, i64 24, !34, i64 36, !23, i64 48, !35, i64 52, !23, i64 60}
!34 = !{!"_ZTSN3JPH6Float3E", !23, i64 0, !23, i64 4, !23, i64 8}
!35 = !{!"_ZTSN3JPH10SpringPartE", !23, i64 0, !23, i64 4}
!36 = !{!8, !23, i64 152}
!37 = !{!8, !17, i64 144}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass