; LLVM IR from jrouwe/JoltPhysics :: Jolt/Physics/Vehicle (TrackedVehicleController)

; 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::TrackedVehicleControllerSettings" = type { %"class.JPH::VehicleControllerSettings.base", %"class.JPH::VehicleEngineSettings", %"class.JPH::VehicleTransmissionSettings", [2 x %"class.JPH::VehicleTrackSettings"] }
%"class.JPH::VehicleControllerSettings.base" = type <{ %"class.JPH::SerializableObject", %"class.JPH::RefTarget" }>
%"class.JPH::SerializableObject" = type { ptr }
%"class.JPH::RefTarget" = type { %"struct.std::atomic" }
%"struct.std::atomic" = type { %"struct.std::__atomic_base" }
%"struct.std::__atomic_base" = type { i32 }
%"class.JPH::VehicleEngineSettings" = type { float, float, float, %"class.JPH::LinearCurve", float, float }
%"class.JPH::LinearCurve" = type { %"class.JPH::Array" }
%"class.JPH::Array" = type { i64, i64, ptr }
%"class.JPH::VehicleTransmissionSettings" = type { i8, %"class.JPH::Array.2", %"class.JPH::Array.2", float, float, float, float, float, float }
%"class.JPH::Array.2" = type { i64, i64, ptr }
%"class.JPH::VehicleTrackSettings" = type { i32, %"class.JPH::Array.5", float, float, float, float }
%"class.JPH::Array.5" = type { i64, i64, ptr }

; 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: mustprogress uwtable
define dso_local void @_ZN3JPH32TrackedVehicleControllerSettings18RestoreBinaryStateERNS_8StreamInE(ptr noundef nonnull align 8 dereferenceable(240) %0, ptr noundef nonnull align 8 dereferenceable(8) %1) unnamed_addr #1 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %9 = load ptr, ptr %3, align 8
  %10 = getelementptr inbounds %"class.JPH::TrackedVehicleControllerSettings", ptr %9, i32 0, i32 1
  %11 = load ptr, ptr %4, align 8, !tbaa !5
  call void @_ZN3JPH21VehicleEngineSettings18RestoreBinaryStateERNS_8StreamInE(ptr noundef nonnull align 8 dereferenceable(48) %10, ptr noundef nonnull align 8 dereferenceable(8) %11)
  %12 = getelementptr inbounds %"class.JPH::TrackedVehicleControllerSettings", ptr %9, i32 0, i32 2
  %13 = load ptr, ptr %4, align 8, !tbaa !5
  call void @_ZN3JPH27VehicleTransmissionSettings18RestoreBinaryStateERNS_8StreamInE(ptr noundef nonnull align 8 dereferenceable(80) %12, ptr noundef nonnull align 8 dereferenceable(8) %13)
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #3
  %14 = getelementptr inbounds %"class.JPH::TrackedVehicleControllerSettings", ptr %9, i32 0, i32 3
  store ptr %14, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #3
  %15 = load ptr, ptr %5, align 8, !tbaa !5
  %16 = getelementptr inbounds [2 x %"class.JPH::VehicleTrackSettings"], ptr %15, i64 0, i64 0
  store ptr %16, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #3
  %17 = load ptr, ptr %5, align 8, !tbaa !5
  %18 = getelementptr inbounds [2 x %"class.JPH::VehicleTrackSettings"], ptr %17, i64 0, i64 0
  %19 = getelementptr inbounds %"class.JPH::VehicleTrackSettings", ptr %18, i64 2
  store ptr %19, ptr %7, align 8, !tbaa !5
  br label %20

20:                                               ; preds = %29, %2
  %21 = load ptr, ptr %6, align 8, !tbaa !5
  %22 = load ptr, ptr %7, align 8, !tbaa !5
  %23 = icmp ne ptr %21, %22
  br i1 %23, label %25, label %24

24:                                               ; preds = %20
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #3
  br label %32

25:                                               ; preds = %20
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #3
  %26 = load ptr, ptr %6, align 8, !tbaa !5
  store ptr %26, ptr %8, align 8, !tbaa !5
  %27 = load ptr, ptr %8, align 8, !tbaa !5
  %28 = load ptr, ptr %4, align 8, !tbaa !5
  call void @_ZN3JPH20VehicleTrackSettings18RestoreBinaryStateERNS_8StreamInE(ptr noundef nonnull align 8 dereferenceable(48) %27, ptr noundef nonnull align 8 dereferenceable(8) %28)
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  br label %29

29:                                               ; preds = %25
  %30 = load ptr, ptr %6, align 8, !tbaa !5
  %31 = getelementptr inbounds %"class.JPH::VehicleTrackSettings", ptr %30, i32 1
  store ptr %31, ptr %6, align 8, !tbaa !5
  br label %20

32:                                               ; preds = %24
  ret void
}

declare void @_ZN3JPH21VehicleEngineSettings18RestoreBinaryStateERNS_8StreamInE(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(8)) #2

declare void @_ZN3JPH27VehicleTransmissionSettings18RestoreBinaryStateERNS_8StreamInE(ptr noundef nonnull align 8 dereferenceable(80), ptr noundef nonnull align 8 dereferenceable(8)) #2

declare void @_ZN3JPH20VehicleTrackSettings18RestoreBinaryStateERNS_8StreamInE(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(8)) #2

attributes #0 = { 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 = { "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 = { 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"}


; 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 uwtable
define dso_local void @_ZN3JPH32TrackedVehicleControllerSettings18RestoreBinaryStateERNS_8StreamInE(ptr noundef nonnull align 8 dereferenceable(240) %0, ptr noundef nonnull align 8 dereferenceable(8) %1) unnamed_addr #0 align 2 {
  %3 = getelementptr inbounds i8, ptr %0, i64 16
  tail call void @_ZN3JPH21VehicleEngineSettings18RestoreBinaryStateERNS_8StreamInE(ptr noundef nonnull align 8 dereferenceable(48) %3, ptr noundef nonnull align 8 dereferenceable(8) %1)
  %4 = getelementptr inbounds i8, ptr %0, i64 64
  tail call void @_ZN3JPH27VehicleTransmissionSettings18RestoreBinaryStateERNS_8StreamInE(ptr noundef nonnull align 8 dereferenceable(80) %4, ptr noundef nonnull align 8 dereferenceable(8) %1)
  %.0.ptr = getelementptr inbounds i8, ptr %0, i64 144
  tail call void @_ZN3JPH20VehicleTrackSettings18RestoreBinaryStateERNS_8StreamInE(ptr noundef nonnull align 8 dereferenceable(48) %.0.ptr, ptr noundef nonnull align 8 dereferenceable(8) %1)
  %.0.ptr.1 = getelementptr inbounds i8, ptr %0, i64 192
  tail call void @_ZN3JPH20VehicleTrackSettings18RestoreBinaryStateERNS_8StreamInE(ptr noundef nonnull align 8 dereferenceable(48) %.0.ptr.1, ptr noundef nonnull align 8 dereferenceable(8) %1)
  ret void
}

declare void @_ZN3JPH21VehicleEngineSettings18RestoreBinaryStateERNS_8StreamInE(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #1

declare void @_ZN3JPH27VehicleTransmissionSettings18RestoreBinaryStateERNS_8StreamInE(ptr noundef nonnull align 8 dereferenceable(80), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #1

declare void @_ZN3JPH20VehicleTrackSettings18RestoreBinaryStateERNS_8StreamInE(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #1

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

!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: EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,LoopRotatePass,SROAPass,SimplifyCFGPass,TailCallElimPass