; LLVM IR from dtecta/motion-toolkit :: jointlimits (EllipticCylinderJointLimits)

; 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.mt::Interval" = type { float, float }
%"class.ik::EllipticCylinderJointLimits" = type { %"class.ik::JointLimits", %"class.mt::Interval", %"class.ik::Ellipse" }
%"class.ik::JointLimits" = type { ptr }
%"class.ik::Ellipse" = type { float, float }

@.str = external hidden unnamed_addr constant [78 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [99 x i8], align 1
@__PRETTY_FUNCTION__._ZN2ik27EllipticCylinderJointLimits19setLocalJointLimitsEffff = external hidden unnamed_addr constant [90 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [41 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [41 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN2ik27EllipticCylinderJointLimits19setLocalJointLimitsEffff(ptr noundef nonnull align 8 dereferenceable(24) %0, float noundef %1, float noundef %2, float noundef %3, float noundef %4) #0 align 2 {
  %6 = alloca ptr, align 8
  %7 = alloca float, align 4
  %8 = alloca float, align 4
  %9 = alloca float, align 4
  %10 = alloca float, align 4
  %11 = alloca %"class.mt::Interval", align 4
  store ptr %0, ptr %6, align 8, !tbaa !5
  store float %1, ptr %7, align 4, !tbaa !9
  store float %2, ptr %8, align 4, !tbaa !9
  store float %3, ptr %9, align 4, !tbaa !9
  store float %4, ptr %10, align 4, !tbaa !9
  %12 = load ptr, ptr %6, align 8
  %13 = call noundef float @_ZN2mt12ScalarTraitsIfE2piEv()
  %14 = fneg float %13
  %15 = load float, ptr %7, align 4, !tbaa !9
  %16 = fcmp ole float %14, %15
  br i1 %16, label %17, label %25

17:                                               ; preds = %5
  %18 = load float, ptr %7, align 4, !tbaa !9
  %19 = load float, ptr %8, align 4, !tbaa !9
  %20 = fcmp ole float %18, %19
  br i1 %20, label %21, label %25

21:                                               ; preds = %17
  %22 = load float, ptr %8, align 4, !tbaa !9
  %23 = call noundef float @_ZN2mt12ScalarTraitsIfE2piEv()
  %24 = fcmp ole float %22, %23
  br label %25

25:                                               ; preds = %21, %17, %5
  %26 = phi i1 [ false, %17 ], [ false, %5 ], [ %24, %21 ]
  br i1 %26, label %27, label %28

27:                                               ; preds = %25
  br label %30

28:                                               ; preds = %25
  call void @__assert_fail(ptr noundef @.str, ptr noundef @.str.1, i32 noundef 21, ptr noundef @__PRETTY_FUNCTION__._ZN2ik27EllipticCylinderJointLimits19setLocalJointLimitsEffff) #7
  unreachable

29:                                               ; No predecessors!
  br label %30

30:                                               ; preds = %29, %27
  %31 = load float, ptr %9, align 4, !tbaa !9
  %32 = fcmp olt float 0.000000e+00, %31
  br i1 %32, label %33, label %37

33:                                               ; preds = %30
  %34 = load float, ptr %9, align 4, !tbaa !9
  %35 = call noundef float @_ZN2mt12ScalarTraitsIfE2piEv()
  %36 = fcmp ole float %34, %35
  br label %37

37:                                               ; preds = %33, %30
  %38 = phi i1 [ false, %30 ], [ %36, %33 ]
  br i1 %38, label %39, label %40

39:                                               ; preds = %37
  br label %42

40:                                               ; preds = %37
  call void @__assert_fail(ptr noundef @.str.2, ptr noundef @.str.1, i32 noundef 22, ptr noundef @__PRETTY_FUNCTION__._ZN2ik27EllipticCylinderJointLimits19setLocalJointLimitsEffff) #7
  unreachable

41:                                               ; No predecessors!
  br label %42

42:                                               ; preds = %41, %39
  %43 = load float, ptr %10, align 4, !tbaa !9
  %44 = fcmp olt float 0.000000e+00, %43
  br i1 %44, label %45, label %49

45:                                               ; preds = %42
  %46 = load float, ptr %10, align 4, !tbaa !9
  %47 = call noundef float @_ZN2mt12ScalarTraitsIfE2piEv()
  %48 = fcmp ole float %46, %47
  br label %49

49:                                               ; preds = %45, %42
  %50 = phi i1 [ false, %42 ], [ %48, %45 ]
  br i1 %50, label %51, label %52

51:                                               ; preds = %49
  br label %54

52:                                               ; preds = %49
  call void @__assert_fail(ptr noundef @.str.3, ptr noundef @.str.1, i32 noundef 23, ptr noundef @__PRETTY_FUNCTION__._ZN2ik27EllipticCylinderJointLimits19setLocalJointLimitsEffff) #7
  unreachable

53:                                               ; No predecessors!
  br label %54

54:                                               ; preds = %53, %51
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #8
  %55 = load float, ptr %7, align 4, !tbaa !9
  %56 = fmul float %55, 5.000000e-01
  %57 = call noundef float @_ZSt3sinf(float noundef %56)
  %58 = load float, ptr %8, align 4, !tbaa !9
  %59 = fmul float %58, 5.000000e-01
  %60 = call noundef float @_ZSt3sinf(float noundef %59)
  call void @_ZN2mt8IntervalIfEC2Eff(ptr noundef nonnull align 4 dereferenceable(8) %11, float noundef %57, float noundef %60)
  %61 = getelementptr inbounds %"class.ik::EllipticCylinderJointLimits", ptr %12, i32 0, i32 1
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %61, ptr align 4 %11, i64 8, i1 false), !tbaa.struct !11
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #8
  %62 = getelementptr inbounds %"class.ik::EllipticCylinderJointLimits", ptr %12, i32 0, i32 2
  %63 = load float, ptr %9, align 4, !tbaa !9
  %64 = fmul float %63, 5.000000e-01
  %65 = call noundef float @_ZSt3sinf(float noundef %64)
  %66 = load float, ptr %10, align 4, !tbaa !9
  %67 = fmul float %66, 5.000000e-01
  %68 = call noundef float @_ZSt3sinf(float noundef %67)
  call void @_ZN2ik7Ellipse9setBoundsEff(ptr noundef nonnull align 4 dereferenceable(8) %62, float noundef %65, float noundef %68)
  ret void
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef float @_ZN2mt12ScalarTraitsIfE2piEv() #1 align 2

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #2

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef float @_ZSt3sinf(float noundef) #4

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local void @_ZN2mt8IntervalIfEC2Eff(ptr noundef nonnull align 4 dereferenceable(8), float noundef, float noundef) unnamed_addr #5 align 2

; 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) #6

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN2ik7Ellipse9setBoundsEff(ptr noundef nonnull align 4 dereferenceable(8), float noundef, float noundef) #1 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 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 = { noreturn nounwind "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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #7 = { noreturn nounwind }
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 = !{!"float", !7, i64 0}
!11 = !{i64 0, i64 4, !9, i64 4, i64 4, !9}


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

@.str = external hidden unnamed_addr constant [78 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [99 x i8], align 1
@__PRETTY_FUNCTION__._ZN2ik27EllipticCylinderJointLimits19setLocalJointLimitsEffff = external hidden unnamed_addr constant [90 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [41 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [41 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN2ik27EllipticCylinderJointLimits19setLocalJointLimitsEffff(ptr noundef nonnull align 8 dereferenceable(24) %0, float noundef %1, float noundef %2, float noundef %3, float noundef %4) local_unnamed_addr #0 align 2 {
  %6 = alloca %"class.mt::Interval", align 8
  %7 = tail call noundef float @_ZN2mt12ScalarTraitsIfE2piEv()
  %8 = fneg float %7
  %9 = fcmp ugt float %8, %1
  %10 = fcmp ugt float %1, %2
  %or.cond = or i1 %10, %9
  br i1 %or.cond, label %.critedge, label %11

11:                                               ; preds = %5
  %12 = tail call noundef float @_ZN2mt12ScalarTraitsIfE2piEv()
  %13 = fcmp ult float %12, %2
  br i1 %13, label %.critedge, label %14

.critedge:                                        ; preds = %5, %11
  tail call void @__assert_fail(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 21, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN2ik27EllipticCylinderJointLimits19setLocalJointLimitsEffff) #5
  unreachable

14:                                               ; preds = %11
  %15 = fcmp ogt float %3, 0.000000e+00
  br i1 %15, label %16, label %.critedge2

16:                                               ; preds = %14
  %17 = tail call noundef float @_ZN2mt12ScalarTraitsIfE2piEv()
  %18 = fcmp ult float %17, %3
  br i1 %18, label %.critedge2, label %19

.critedge2:                                       ; preds = %14, %16
  tail call void @__assert_fail(ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.1, i32 noundef 22, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN2ik27EllipticCylinderJointLimits19setLocalJointLimitsEffff) #5
  unreachable

19:                                               ; preds = %16
  %20 = fcmp ogt float %4, 0.000000e+00
  br i1 %20, label %21, label %.critedge4

21:                                               ; preds = %19
  %22 = tail call noundef float @_ZN2mt12ScalarTraitsIfE2piEv()
  %23 = fcmp ult float %22, %4
  br i1 %23, label %.critedge4, label %24

.critedge4:                                       ; preds = %19, %21
  tail call void @__assert_fail(ptr noundef nonnull @.str.3, ptr noundef nonnull @.str.1, i32 noundef 23, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN2ik27EllipticCylinderJointLimits19setLocalJointLimitsEffff) #5
  unreachable

24:                                               ; preds = %21
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #6
  %25 = fmul float %1, 5.000000e-01
  %26 = tail call noundef float @_ZSt3sinf(float noundef %25)
  %27 = fmul float %2, 5.000000e-01
  %28 = tail call noundef float @_ZSt3sinf(float noundef %27)
  call void @_ZN2mt8IntervalIfEC2Eff(ptr noundef nonnull align 4 dereferenceable(8) %6, float noundef %26, float noundef %28)
  %29 = getelementptr inbounds i8, ptr %0, i64 8
  %30 = load i64, ptr %6, align 8
  store i64 %30, ptr %29, align 8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #6
  %31 = getelementptr inbounds i8, ptr %0, i64 16
  %32 = fmul float %3, 5.000000e-01
  %33 = call noundef float @_ZSt3sinf(float noundef %32)
  %34 = fmul float %4, 5.000000e-01
  %35 = call noundef float @_ZSt3sinf(float noundef %34)
  call void @_ZN2ik7Ellipse9setBoundsEff(ptr noundef nonnull align 4 dereferenceable(8) %31, float noundef %33, float noundef %35)
  ret void
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef float @_ZN2mt12ScalarTraitsIfE2piEv() local_unnamed_addr #0 align 2

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #1

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef float @_ZSt3sinf(float noundef) local_unnamed_addr #3

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local void @_ZN2mt8IntervalIfEC2Eff(ptr noundef nonnull align 4 dereferenceable(8), float noundef, float noundef) unnamed_addr #4 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN2ik7Ellipse9setBoundsEff(ptr noundef nonnull align 4 dereferenceable(8), float noundef, float noundef) local_unnamed_addr #0 align 2

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 = { noreturn nounwind "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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 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 = { noreturn nounwind }
attributes #6 = { 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)"}


; Effective O3 passes: GlobalOptPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass