; LLVM IR from jrouwe/JoltPhysics :: Jolt/Physics/Constraints (Constraint)

; 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::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::ConstraintSettings" = type { %"class.JPH::SerializableObject", %"class.JPH::RefTarget", i8, i32, i32, i32, float, i64 }
%"class.JPH::SerializableObject" = type { ptr }
%"class.JPH::RefTarget" = type { %"struct.std::atomic" }

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZNK3JPH10Constraint20ToConstraintSettingsERNS_18ConstraintSettingsE(ptr noundef nonnull align 8 dereferenceable(32) %0, ptr noundef nonnull align 8 dereferenceable(40) %1) #0 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %5 = load ptr, ptr %3, align 8
  %6 = getelementptr inbounds %"class.JPH::Constraint", ptr %5, i32 0, i32 6
  %7 = load i8, ptr %6, align 2, !tbaa !9, !range !17, !noundef !18
  %8 = trunc i8 %7 to i1
  %9 = load ptr, ptr %4, align 8, !tbaa !5
  %10 = getelementptr inbounds %"class.JPH::ConstraintSettings", ptr %9, i32 0, i32 2
  %11 = zext i1 %8 to i8
  store i8 %11, ptr %10, align 4, !tbaa !19
  %12 = getelementptr inbounds %"class.JPH::Constraint", ptr %5, i32 0, i32 3
  %13 = load i32, ptr %12, align 8, !tbaa !24
  %14 = load ptr, ptr %4, align 8, !tbaa !5
  %15 = getelementptr inbounds %"class.JPH::ConstraintSettings", ptr %14, i32 0, i32 3
  store i32 %13, ptr %15, align 8, !tbaa !25
  %16 = getelementptr inbounds %"class.JPH::Constraint", ptr %5, i32 0, i32 4
  %17 = load i8, ptr %16, align 4, !tbaa !26
  %18 = zext i8 %17 to i32
  %19 = load ptr, ptr %4, align 8, !tbaa !5
  %20 = getelementptr inbounds %"class.JPH::ConstraintSettings", ptr %19, i32 0, i32 4
  store i32 %18, ptr %20, align 4, !tbaa !27
  %21 = getelementptr inbounds %"class.JPH::Constraint", ptr %5, i32 0, i32 5
  %22 = load i8, ptr %21, align 1, !tbaa !28
  %23 = zext i8 %22 to i32
  %24 = load ptr, ptr %4, align 8, !tbaa !5
  %25 = getelementptr inbounds %"class.JPH::ConstraintSettings", ptr %24, i32 0, i32 5
  store i32 %23, ptr %25, align 8, !tbaa !29
  %26 = getelementptr inbounds %"class.JPH::Constraint", ptr %5, i32 0, i32 7
  %27 = load i64, ptr %26, align 8, !tbaa !30
  %28 = load ptr, ptr %4, align 8, !tbaa !5
  %29 = getelementptr inbounds %"class.JPH::ConstraintSettings", ptr %28, i32 0, i32 7
  store i64 %27, ptr %29, align 8, !tbaa !31
  ret void
}

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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !15, i64 22}
!10 = !{!"_ZTSN3JPH10ConstraintE", !11, i64 8, !14, i64 12, !14, i64 16, !7, i64 20, !7, i64 21, !15, i64 22, !16, i64 24}
!11 = !{!"_ZTSN3JPH9RefTargetINS_10ConstraintEEE", !12, i64 0}
!12 = !{!"_ZTSSt6atomicIjE", !13, i64 0}
!13 = !{!"_ZTSSt13__atomic_baseIjE", !14, i64 0}
!14 = !{!"int", !7, i64 0}
!15 = !{!"bool", !7, i64 0}
!16 = !{!"long", !7, i64 0}
!17 = !{i8 0, i8 2}
!18 = !{}
!19 = !{!20, !15, i64 12}
!20 = !{!"_ZTSN3JPH18ConstraintSettingsE", !21, i64 0, !22, i64 8, !15, i64 12, !14, i64 16, !14, i64 20, !14, i64 24, !23, i64 28, !16, i64 32}
!21 = !{!"_ZTSN3JPH18SerializableObjectE"}
!22 = !{!"_ZTSN3JPH9RefTargetINS_18ConstraintSettingsEEE", !12, i64 0}
!23 = !{!"float", !7, i64 0}
!24 = !{!10, !14, i64 16}
!25 = !{!20, !14, i64 16}
!26 = !{!10, !7, i64 20}
!27 = !{!20, !14, i64 20}
!28 = !{!10, !7, i64 21}
!29 = !{!20, !14, i64 24}
!30 = !{!10, !16, i64 24}
!31 = !{!20, !16, i64 32}


; 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 nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local void @_ZNK3JPH10Constraint20ToConstraintSettingsERNS_18ConstraintSettingsE(ptr nocapture noundef nonnull readonly align 8 dereferenceable(32) %0, ptr nocapture noundef nonnull writeonly align 8 dereferenceable(40) %1) local_unnamed_addr #0 align 2 {
  %3 = getelementptr inbounds i8, ptr %0, i64 22
  %4 = load i8, ptr %3, align 2, !tbaa !5, !range !15, !noundef !16
  %5 = getelementptr inbounds i8, ptr %1, i64 12
  store i8 %4, ptr %5, align 4, !tbaa !17
  %6 = getelementptr inbounds i8, ptr %0, i64 16
  %7 = load i32, ptr %6, align 8, !tbaa !22
  %8 = getelementptr inbounds i8, ptr %1, i64 16
  store i32 %7, ptr %8, align 8, !tbaa !23
  %9 = getelementptr inbounds i8, ptr %0, i64 20
  %10 = getelementptr inbounds i8, ptr %1, i64 20
  %11 = load <2 x i8>, ptr %9, align 4, !tbaa !24
  %12 = zext <2 x i8> %11 to <2 x i32>
  store <2 x i32> %12, ptr %10, align 4, !tbaa !25
  %13 = getelementptr inbounds i8, ptr %0, i64 24
  %14 = load i64, ptr %13, align 8, !tbaa !26
  %15 = getelementptr inbounds i8, ptr %1, i64 32
  store i64 %14, ptr %15, align 8, !tbaa !27
  ret void
}

attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) 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, !13, i64 22}
!6 = !{!"_ZTSN3JPH10ConstraintE", !7, i64 8, !10, i64 12, !10, i64 16, !11, i64 20, !11, i64 21, !13, i64 22, !14, i64 24}
!7 = !{!"_ZTSN3JPH9RefTargetINS_10ConstraintEEE", !8, i64 0}
!8 = !{!"_ZTSSt6atomicIjE", !9, i64 0}
!9 = !{!"_ZTSSt13__atomic_baseIjE", !10, i64 0}
!10 = !{!"int", !11, i64 0}
!11 = !{!"omnipotent char", !12, i64 0}
!12 = !{!"Simple C++ TBAA"}
!13 = !{!"bool", !11, i64 0}
!14 = !{!"long", !11, i64 0}
!15 = !{i8 0, i8 2}
!16 = !{}
!17 = !{!18, !13, i64 12}
!18 = !{!"_ZTSN3JPH18ConstraintSettingsE", !19, i64 0, !20, i64 8, !13, i64 12, !10, i64 16, !10, i64 20, !10, i64 24, !21, i64 28, !14, i64 32}
!19 = !{!"_ZTSN3JPH18SerializableObjectE"}
!20 = !{!"_ZTSN3JPH9RefTargetINS_18ConstraintSettingsEEE", !8, i64 0}
!21 = !{!"float", !11, i64 0}
!22 = !{!6, !10, i64 16}
!23 = !{!18, !10, i64 16}
!24 = !{!11, !11, i64 0}
!25 = !{!10, !10, i64 0}
!26 = !{!6, !14, i64 24}
!27 = !{!18, !14, i64 32}


; Effective O3 passes: GlobalOptPass,IPSCCPPass,InstCombinePass,PostOrderFunctionAttrsPass,SLPVectorizerPass,SROAPass