; LLVM IR from ClementineAccount/Albuquerque :: lib/bullet/include/Bullet3Dynamics/ConstraintSolver (b3Generic6DofConstraint)

; 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.b3Generic6DofConstraint = type { %class.b3TypedConstraint, %class.b3Transform, %class.b3Transform, %class.b3TranslationalLimitMotor, [3 x %class.b3RotationalLimitMotor], %class.b3Transform, %class.b3Transform, %class.b3Vector3, [3 x %class.b3Vector3], %class.b3Vector3, float, float, float, i8, %class.b3Vector3, i8, i8, i32, [8 x i8] }
%class.b3TypedConstraint = type { ptr, %struct.b3TypedObject, i32, %union.anon, float, i8, i8, i32, i32, i32, float, float, ptr }
%struct.b3TypedObject = type { i32 }
%union.anon = type { ptr }
%class.b3TranslationalLimitMotor = type { %class.b3Vector3, %class.b3Vector3, %class.b3Vector3, %class.b3Vector3, %class.b3Vector3, %class.b3Vector3, %class.b3Vector3, %class.b3Vector3, %class.b3Vector3, %class.b3Vector3, float, float, float, [3 x i8], [3 x i32], [4 x i8] }
%class.b3RotationalLimitMotor = type { float, float, float, float, float, float, float, float, float, float, float, i8, float, float, i32, float }
%class.b3Transform = type { %class.b3Matrix3x3, %class.b3Vector3 }
%class.b3Matrix3x3 = type { [3 x %class.b3Vector3] }
%class.b3Vector3 = type { %union.anon.0 }
%union.anon.0 = type { [4 x float] }

@_ZTV23b3Generic6DofConstraint = external dso_local unnamed_addr constant { [11 x ptr] }, align 8

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN23b3Generic6DofConstraintC2EiiRK11b3TransformS2_bPK15b3RigidBodyData(ptr noundef nonnull align 16 dereferenceable(824) %0, i32 noundef %1, i32 noundef %2, ptr noundef nonnull align 16 dereferenceable(64) %3, ptr noundef nonnull align 16 dereferenceable(64) %4, i1 noundef zeroext %5, ptr noundef %6) unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca i8, align 1
  %14 = alloca ptr, align 8
  %15 = alloca ptr, align 8
  %16 = alloca i32, align 4
  store ptr %0, ptr %8, align 8, !tbaa !5
  store i32 %1, ptr %9, align 4, !tbaa !9
  store i32 %2, ptr %10, align 4, !tbaa !9
  store ptr %3, ptr %11, align 8, !tbaa !5
  store ptr %4, ptr %12, align 8, !tbaa !5
  %17 = zext i1 %5 to i8
  store i8 %17, ptr %13, align 1, !tbaa !11
  store ptr %6, ptr %14, align 8, !tbaa !5
  %18 = load ptr, ptr %8, align 8
  %19 = load i32, ptr %9, align 4, !tbaa !9
  %20 = load i32, ptr %10, align 4, !tbaa !9
  call void @_ZN17b3TypedConstraintC2E21b3TypedConstraintTypeii(ptr noundef nonnull align 16 dereferenceable(64) %18, i32 noundef 6, i32 noundef %19, i32 noundef %20)
  store ptr getelementptr inbounds inrange(-16, 72) ({ [11 x ptr] }, ptr @_ZTV23b3Generic6DofConstraint, i32 0, i32 0, i32 2), ptr %18, align 16, !tbaa !13
  %21 = getelementptr inbounds %class.b3Generic6DofConstraint, ptr %18, i32 0, i32 1
  %22 = load ptr, ptr %11, align 8, !tbaa !5
  invoke void @_ZN11b3TransformC2ERKS_(ptr noundef nonnull align 16 dereferenceable(64) %21, ptr noundef nonnull align 16 dereferenceable(64) %22)
          to label %23 unwind label %54

23:                                               ; preds = %7
  %24 = getelementptr inbounds %class.b3Generic6DofConstraint, ptr %18, i32 0, i32 2
  %25 = load ptr, ptr %12, align 8, !tbaa !5
  invoke void @_ZN11b3TransformC2ERKS_(ptr noundef nonnull align 16 dereferenceable(64) %24, ptr noundef nonnull align 16 dereferenceable(64) %25)
          to label %26 unwind label %54

26:                                               ; preds = %23
  %27 = getelementptr inbounds %class.b3Generic6DofConstraint, ptr %18, i32 0, i32 3
  invoke void @_ZN25b3TranslationalLimitMotorC2Ev(ptr noundef nonnull align 16 dereferenceable(188) %27)
          to label %28 unwind label %54

28:                                               ; preds = %26
  %29 = getelementptr inbounds %class.b3Generic6DofConstraint, ptr %18, i32 0, i32 4
  %30 = getelementptr inbounds [3 x %class.b3RotationalLimitMotor], ptr %29, i32 0, i32 0
  %31 = getelementptr inbounds %class.b3RotationalLimitMotor, ptr %30, i64 3
  br label %32

32:                                               ; preds = %34, %28
  %33 = phi ptr [ %30, %28 ], [ %35, %34 ]
  invoke void @_ZN22b3RotationalLimitMotorC2Ev(ptr noundef nonnull align 4 dereferenceable(64) %33)
          to label %34 unwind label %54

34:                                               ; preds = %32
  %35 = getelementptr inbounds %class.b3RotationalLimitMotor, ptr %33, i64 1
  %36 = icmp eq ptr %35, %31
  br i1 %36, label %37, label %32

37:                                               ; preds = %34
  %38 = getelementptr inbounds %class.b3Generic6DofConstraint, ptr %18, i32 0, i32 5
  invoke void @_ZN11b3TransformC2Ev(ptr noundef nonnull align 16 dereferenceable(64) %38)
          to label %39 unwind label %54

39:                                               ; preds = %37
  %40 = getelementptr inbounds %class.b3Generic6DofConstraint, ptr %18, i32 0, i32 6
  invoke void @_ZN11b3TransformC2Ev(ptr noundef nonnull align 16 dereferenceable(64) %40)
          to label %41 unwind label %54

41:                                               ; preds = %39
  %42 = getelementptr inbounds %class.b3Generic6DofConstraint, ptr %18, i32 0, i32 7
  %43 = getelementptr inbounds %class.b3Generic6DofConstraint, ptr %18, i32 0, i32 8
  %44 = getelementptr inbounds %class.b3Generic6DofConstraint, ptr %18, i32 0, i32 9
  %45 = getelementptr inbounds %class.b3Generic6DofConstraint, ptr %18, i32 0, i32 14
  %46 = getelementptr inbounds %class.b3Generic6DofConstraint, ptr %18, i32 0, i32 15
  %47 = load i8, ptr %13, align 1, !tbaa !11, !range !15, !noundef !16
  %48 = trunc i8 %47 to i1
  %49 = zext i1 %48 to i8
  store i8 %49, ptr %46, align 16, !tbaa !17
  %50 = getelementptr inbounds %class.b3Generic6DofConstraint, ptr %18, i32 0, i32 16
  store i8 1, ptr %50, align 1, !tbaa !26
  %51 = getelementptr inbounds %class.b3Generic6DofConstraint, ptr %18, i32 0, i32 17
  store i32 0, ptr %51, align 4, !tbaa !27
  %52 = load ptr, ptr %14, align 8, !tbaa !5
  invoke void @_ZN23b3Generic6DofConstraint19calculateTransformsEPK15b3RigidBodyData(ptr noundef nonnull align 16 dereferenceable(824) %18, ptr noundef %52)
          to label %53 unwind label %54

53:                                               ; preds = %41
  ret void

54:                                               ; preds = %41, %39, %37, %32, %26, %23, %7
  %55 = landingpad { ptr, i32 }
          cleanup
  %56 = extractvalue { ptr, i32 } %55, 0
  store ptr %56, ptr %15, align 8
  %57 = extractvalue { ptr, i32 } %55, 1
  store i32 %57, ptr %16, align 4
  call void @_ZN17b3TypedConstraintD2Ev(ptr noundef nonnull align 16 dereferenceable(64) %18) #4
  br label %58

58:                                               ; preds = %54
  %59 = load ptr, ptr %15, align 8
  %60 = load i32, ptr %16, align 4
  %61 = insertvalue { ptr, i32 } poison, ptr %59, 0
  %62 = insertvalue { ptr, i32 } %61, i32 %60, 1
  resume { ptr, i32 } %62
}

declare void @_ZN17b3TypedConstraintC2E21b3TypedConstraintTypeii(ptr noundef nonnull align 16 dereferenceable(64), i32 noundef, i32 noundef, i32 noundef) unnamed_addr #1

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN11b3TransformC2ERKS_(ptr noundef nonnull align 16 dereferenceable(64), ptr noundef nonnull align 16 dereferenceable(64)) unnamed_addr #2 align 2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN25b3TranslationalLimitMotorC2Ev(ptr noundef nonnull align 16 dereferenceable(188)) unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN22b3RotationalLimitMotorC2Ev(ptr noundef nonnull align 4 dereferenceable(64)) unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN11b3TransformC2Ev(ptr noundef nonnull align 16 dereferenceable(64)) unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN23b3Generic6DofConstraint19calculateTransformsEPK15b3RigidBodyData(ptr noundef nonnull align 16 dereferenceable(824), ptr noundef) #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN17b3TypedConstraintD2Ev(ptr noundef nonnull align 16 dereferenceable(64)) unnamed_addr #3 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 = { "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 = { 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 = { 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 = !{!12, !12, i64 0}
!12 = !{!"bool", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"vtable pointer", !8, i64 0}
!15 = !{i8 0, i8 2}
!16 = !{}
!17 = !{!18, !12, i64 816}
!18 = !{!"_ZTS23b3Generic6DofConstraint", !19, i64 0, !22, i64 64, !22, i64 128, !25, i64 192, !7, i64 384, !22, i64 576, !22, i64 640, !24, i64 704, !7, i64 720, !24, i64 768, !21, i64 784, !21, i64 788, !21, i64 792, !12, i64 796, !24, i64 800, !12, i64 816, !12, i64 817, !10, i64 820}
!19 = !{!"_ZTS17b3TypedConstraint", !20, i64 8, !10, i64 12, !7, i64 16, !21, i64 24, !12, i64 28, !12, i64 29, !10, i64 32, !10, i64 36, !10, i64 40, !21, i64 44, !21, i64 48, !6, i64 56}
!20 = !{!"_ZTS13b3TypedObject", !10, i64 0}
!21 = !{!"float", !7, i64 0}
!22 = !{!"_ZTS11b3Transform", !23, i64 0, !24, i64 48}
!23 = !{!"_ZTS11b3Matrix3x3", !7, i64 0}
!24 = !{!"_ZTS9b3Vector3", !7, i64 0}
!25 = !{!"_ZTS25b3TranslationalLimitMotor", !24, i64 0, !24, i64 16, !24, i64 32, !24, i64 48, !24, i64 64, !24, i64 80, !24, i64 96, !24, i64 112, !24, i64 128, !24, i64 144, !21, i64 160, !21, i64 164, !21, i64 168, !7, i64 172, !7, i64 176}
!26 = !{!18, !12, i64 817}
!27 = !{!18, !10, i64 820}


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

@_ZTV23b3Generic6DofConstraint = external dso_local unnamed_addr constant { [11 x ptr] }, align 8

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN23b3Generic6DofConstraintC2EiiRK11b3TransformS2_bPK15b3RigidBodyData(ptr noundef nonnull align 16 dereferenceable(824) %0, i32 noundef %1, i32 noundef %2, ptr noundef nonnull align 16 dereferenceable(64) %3, ptr noundef nonnull align 16 dereferenceable(64) %4, i1 noundef zeroext %5, ptr noundef %6) unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  %8 = zext i1 %5 to i8
  tail call void @_ZN17b3TypedConstraintC2E21b3TypedConstraintTypeii(ptr noundef nonnull align 16 dereferenceable(64) %0, i32 noundef 6, i32 noundef %1, i32 noundef %2)
  store ptr getelementptr inbounds inrange(-16, 72) (i8, ptr @_ZTV23b3Generic6DofConstraint, i64 16), ptr %0, align 16, !tbaa !5
  %9 = getelementptr inbounds i8, ptr %0, i64 64
  invoke void @_ZN11b3TransformC2ERKS_(ptr noundef nonnull align 16 dereferenceable(64) %9, ptr noundef nonnull align 16 dereferenceable(64) %3)
          to label %10 unwind label %22

10:                                               ; preds = %7
  %11 = getelementptr inbounds i8, ptr %0, i64 128
  invoke void @_ZN11b3TransformC2ERKS_(ptr noundef nonnull align 16 dereferenceable(64) %11, ptr noundef nonnull align 16 dereferenceable(64) %4)
          to label %12 unwind label %22

12:                                               ; preds = %10
  %13 = getelementptr inbounds i8, ptr %0, i64 192
  invoke void @_ZN25b3TranslationalLimitMotorC2Ev(ptr noundef nonnull align 16 dereferenceable(188) %13)
          to label %.preheader.preheader unwind label %22

.preheader.preheader:                             ; preds = %12
  %.ptr = getelementptr inbounds i8, ptr %0, i64 384
  tail call void @_ZN22b3RotationalLimitMotorC2Ev(ptr noundef nonnull align 4 dereferenceable(64) %.ptr)
  %.ptr.1 = getelementptr inbounds i8, ptr %0, i64 448
  tail call void @_ZN22b3RotationalLimitMotorC2Ev(ptr noundef nonnull align 4 dereferenceable(64) %.ptr.1)
  %.ptr.2 = getelementptr inbounds i8, ptr %0, i64 512
  tail call void @_ZN22b3RotationalLimitMotorC2Ev(ptr noundef nonnull align 4 dereferenceable(64) %.ptr.2)
  %14 = getelementptr inbounds i8, ptr %0, i64 576
  invoke void @_ZN11b3TransformC2Ev(ptr noundef nonnull align 16 dereferenceable(64) %14)
          to label %15 unwind label %22

15:                                               ; preds = %.preheader.preheader
  %16 = getelementptr inbounds i8, ptr %0, i64 640
  invoke void @_ZN11b3TransformC2Ev(ptr noundef nonnull align 16 dereferenceable(64) %16)
          to label %17 unwind label %22

17:                                               ; preds = %15
  %18 = getelementptr inbounds i8, ptr %0, i64 816
  store i8 %8, ptr %18, align 16, !tbaa !8
  %19 = getelementptr inbounds i8, ptr %0, i64 817
  store i8 1, ptr %19, align 1, !tbaa !21
  %20 = getelementptr inbounds i8, ptr %0, i64 820
  store i32 0, ptr %20, align 4, !tbaa !22
  invoke void @_ZN23b3Generic6DofConstraint19calculateTransformsEPK15b3RigidBodyData(ptr noundef nonnull align 16 dereferenceable(824) %0, ptr noundef %6)
          to label %21 unwind label %22

21:                                               ; preds = %17
  ret void

22:                                               ; preds = %17, %15, %.preheader.preheader, %12, %10, %7
  %23 = landingpad { ptr, i32 }
          cleanup
  tail call void @_ZN17b3TypedConstraintD2Ev(ptr noundef nonnull align 16 dereferenceable(64) %0) #4
  resume { ptr, i32 } %23
}

declare void @_ZN17b3TypedConstraintC2E21b3TypedConstraintTypeii(ptr noundef nonnull align 16 dereferenceable(64), i32 noundef, i32 noundef, i32 noundef) unnamed_addr #1

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN11b3TransformC2ERKS_(ptr noundef nonnull align 16 dereferenceable(64), ptr noundef nonnull align 16 dereferenceable(64)) unnamed_addr #2 align 2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN25b3TranslationalLimitMotorC2Ev(ptr noundef nonnull align 16 dereferenceable(188)) unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN22b3RotationalLimitMotorC2Ev(ptr noundef nonnull align 4 dereferenceable(64)) unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN11b3TransformC2Ev(ptr noundef nonnull align 16 dereferenceable(64)) unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN23b3Generic6DofConstraint19calculateTransformsEPK15b3RigidBodyData(ptr noundef nonnull align 16 dereferenceable(824), ptr noundef) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN17b3TypedConstraintD2Ev(ptr noundef nonnull align 16 dereferenceable(64)) unnamed_addr #3 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 = { "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 = { 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 = { 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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !15, i64 816}
!9 = !{!"_ZTS23b3Generic6DofConstraint", !10, i64 0, !17, i64 64, !17, i64 128, !20, i64 192, !13, i64 384, !17, i64 576, !17, i64 640, !19, i64 704, !13, i64 720, !19, i64 768, !14, i64 784, !14, i64 788, !14, i64 792, !15, i64 796, !19, i64 800, !15, i64 816, !15, i64 817, !12, i64 820}
!10 = !{!"_ZTS17b3TypedConstraint", !11, i64 8, !12, i64 12, !13, i64 16, !14, i64 24, !15, i64 28, !15, i64 29, !12, i64 32, !12, i64 36, !12, i64 40, !14, i64 44, !14, i64 48, !16, i64 56}
!11 = !{!"_ZTS13b3TypedObject", !12, i64 0}
!12 = !{!"int", !13, i64 0}
!13 = !{!"omnipotent char", !7, i64 0}
!14 = !{!"float", !13, i64 0}
!15 = !{!"bool", !13, i64 0}
!16 = !{!"any pointer", !13, i64 0}
!17 = !{!"_ZTS11b3Transform", !18, i64 0, !19, i64 48}
!18 = !{!"_ZTS11b3Matrix3x3", !13, i64 0}
!19 = !{!"_ZTS9b3Vector3", !13, i64 0}
!20 = !{!"_ZTS25b3TranslationalLimitMotor", !19, i64 0, !19, i64 16, !19, i64 32, !19, i64 48, !19, i64 64, !19, i64 80, !19, i64 96, !19, i64 112, !19, i64 128, !19, i64 144, !14, i64 160, !14, i64 164, !14, i64 168, !13, i64 172, !13, i64 176}
!21 = !{!9, !15, i64 817}
!22 = !{!9, !12, i64 820}


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