; 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::TrackedVehicleController" = type { %"class.JPH::VehicleController", float, float, float, float, %"class.JPH::VehicleEngine", %"class.JPH::VehicleTransmission", [2 x %"class.JPH::VehicleTrack"] }
%"class.JPH::VehicleController" = type { ptr, ptr }
%"class.JPH::VehicleEngine" = type <{ %"class.JPH::VehicleEngineSettings", float, [4 x i8] }>
%"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::VehicleTransmission" = type <{ %"class.JPH::VehicleTransmissionSettings", i32, float, float, float, float, [4 x i8] }>
%"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::VehicleTrack" = type <{ %"class.JPH::VehicleTrackSettings", float, [4 x i8] }>
%"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
declare dso_local void @_ZN3JPH9StreamOut5WriteIfTnNSt9enable_ifIXsr3stdE23is_trivially_copyable_vIT_EEbE4typeELb1EEEvRKS3_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(4)) #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK3JPH24TrackedVehicleController9SaveStateERNS_13StateRecorderE(ptr noundef nonnull align 8 dereferenceable(304) %0, ptr noundef nonnull align 8 dereferenceable(18) %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 = load ptr, ptr %4, align 8, !tbaa !5
  %11 = getelementptr inbounds i8, ptr %10, i64 8
  %12 = getelementptr inbounds %"class.JPH::TrackedVehicleController", ptr %9, i32 0, i32 1
  call void @_ZN3JPH9StreamOut5WriteIfTnNSt9enable_ifIXsr3stdE23is_trivially_copyable_vIT_EEbE4typeELb1EEEvRKS3_(ptr noundef nonnull align 8 dereferenceable(8) %11, ptr noundef nonnull align 4 dereferenceable(4) %12)
  %13 = load ptr, ptr %4, align 8, !tbaa !5
  %14 = getelementptr inbounds i8, ptr %13, i64 8
  %15 = getelementptr inbounds %"class.JPH::TrackedVehicleController", ptr %9, i32 0, i32 2
  call void @_ZN3JPH9StreamOut5WriteIfTnNSt9enable_ifIXsr3stdE23is_trivially_copyable_vIT_EEbE4typeELb1EEEvRKS3_(ptr noundef nonnull align 8 dereferenceable(8) %14, ptr noundef nonnull align 4 dereferenceable(4) %15)
  %16 = load ptr, ptr %4, align 8, !tbaa !5
  %17 = getelementptr inbounds i8, ptr %16, i64 8
  %18 = getelementptr inbounds %"class.JPH::TrackedVehicleController", ptr %9, i32 0, i32 3
  call void @_ZN3JPH9StreamOut5WriteIfTnNSt9enable_ifIXsr3stdE23is_trivially_copyable_vIT_EEbE4typeELb1EEEvRKS3_(ptr noundef nonnull align 8 dereferenceable(8) %17, ptr noundef nonnull align 4 dereferenceable(4) %18)
  %19 = load ptr, ptr %4, align 8, !tbaa !5
  %20 = getelementptr inbounds i8, ptr %19, i64 8
  %21 = getelementptr inbounds %"class.JPH::TrackedVehicleController", ptr %9, i32 0, i32 4
  call void @_ZN3JPH9StreamOut5WriteIfTnNSt9enable_ifIXsr3stdE23is_trivially_copyable_vIT_EEbE4typeELb1EEEvRKS3_(ptr noundef nonnull align 8 dereferenceable(8) %20, ptr noundef nonnull align 4 dereferenceable(4) %21)
  %22 = getelementptr inbounds %"class.JPH::TrackedVehicleController", ptr %9, i32 0, i32 5
  %23 = load ptr, ptr %4, align 8, !tbaa !5
  call void @_ZNK3JPH13VehicleEngine9SaveStateERNS_13StateRecorderE(ptr noundef nonnull align 8 dereferenceable(52) %22, ptr noundef nonnull align 8 dereferenceable(18) %23)
  %24 = getelementptr inbounds %"class.JPH::TrackedVehicleController", ptr %9, i32 0, i32 6
  %25 = load ptr, ptr %4, align 8, !tbaa !5
  call void @_ZNK3JPH19VehicleTransmission9SaveStateERNS_13StateRecorderE(ptr noundef nonnull align 8 dereferenceable(100) %24, ptr noundef nonnull align 8 dereferenceable(18) %25)
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #3
  %26 = getelementptr inbounds %"class.JPH::TrackedVehicleController", ptr %9, i32 0, i32 7
  store ptr %26, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #3
  %27 = load ptr, ptr %5, align 8, !tbaa !5
  %28 = getelementptr inbounds [2 x %"class.JPH::VehicleTrack"], ptr %27, i64 0, i64 0
  store ptr %28, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #3
  %29 = load ptr, ptr %5, align 8, !tbaa !5
  %30 = getelementptr inbounds [2 x %"class.JPH::VehicleTrack"], ptr %29, i64 0, i64 0
  %31 = getelementptr inbounds %"class.JPH::VehicleTrack", ptr %30, i64 2
  store ptr %31, ptr %7, align 8, !tbaa !5
  br label %32

32:                                               ; preds = %41, %2
  %33 = load ptr, ptr %6, align 8, !tbaa !5
  %34 = load ptr, ptr %7, align 8, !tbaa !5
  %35 = icmp ne ptr %33, %34
  br i1 %35, label %37, label %36

36:                                               ; preds = %32
  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 %44

37:                                               ; preds = %32
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #3
  %38 = load ptr, ptr %6, align 8, !tbaa !5
  store ptr %38, ptr %8, align 8, !tbaa !5
  %39 = load ptr, ptr %8, align 8, !tbaa !5
  %40 = load ptr, ptr %4, align 8, !tbaa !5
  call void @_ZNK3JPH12VehicleTrack9SaveStateERNS_13StateRecorderE(ptr noundef nonnull align 8 dereferenceable(52) %39, ptr noundef nonnull align 8 dereferenceable(18) %40)
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  br label %41

41:                                               ; preds = %37
  %42 = load ptr, ptr %6, align 8, !tbaa !5
  %43 = getelementptr inbounds %"class.JPH::VehicleTrack", ptr %42, i32 1
  store ptr %43, ptr %6, align 8, !tbaa !5
  br label %32

44:                                               ; preds = %36
  ret void
}

declare void @_ZNK3JPH13VehicleEngine9SaveStateERNS_13StateRecorderE(ptr noundef nonnull align 8 dereferenceable(52), ptr noundef nonnull align 8 dereferenceable(18)) #2

declare void @_ZNK3JPH19VehicleTransmission9SaveStateERNS_13StateRecorderE(ptr noundef nonnull align 8 dereferenceable(100), ptr noundef nonnull align 8 dereferenceable(18)) #2

declare void @_ZNK3JPH12VehicleTrack9SaveStateERNS_13StateRecorderE(ptr noundef nonnull align 8 dereferenceable(52), ptr noundef nonnull align 8 dereferenceable(18)) #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
declare dso_local void @_ZN3JPH9StreamOut5WriteIfTnNSt9enable_ifIXsr3stdE23is_trivially_copyable_vIT_EEbE4typeELb1EEEvRKS3_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK3JPH24TrackedVehicleController9SaveStateERNS_13StateRecorderE(ptr noundef nonnull align 8 dereferenceable(304) %0, ptr noundef nonnull align 8 dereferenceable(18) %1) unnamed_addr #0 align 2 {
  %3 = getelementptr inbounds i8, ptr %1, i64 8
  %4 = getelementptr inbounds i8, ptr %0, i64 16
  tail call void @_ZN3JPH9StreamOut5WriteIfTnNSt9enable_ifIXsr3stdE23is_trivially_copyable_vIT_EEbE4typeELb1EEEvRKS3_(ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 4 dereferenceable(4) %4)
  %5 = getelementptr inbounds i8, ptr %0, i64 20
  tail call void @_ZN3JPH9StreamOut5WriteIfTnNSt9enable_ifIXsr3stdE23is_trivially_copyable_vIT_EEbE4typeELb1EEEvRKS3_(ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 4 dereferenceable(4) %5)
  %6 = getelementptr inbounds i8, ptr %0, i64 24
  tail call void @_ZN3JPH9StreamOut5WriteIfTnNSt9enable_ifIXsr3stdE23is_trivially_copyable_vIT_EEbE4typeELb1EEEvRKS3_(ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 4 dereferenceable(4) %6)
  %7 = getelementptr inbounds i8, ptr %0, i64 28
  tail call void @_ZN3JPH9StreamOut5WriteIfTnNSt9enable_ifIXsr3stdE23is_trivially_copyable_vIT_EEbE4typeELb1EEEvRKS3_(ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 4 dereferenceable(4) %7)
  %8 = getelementptr inbounds i8, ptr %0, i64 32
  tail call void @_ZNK3JPH13VehicleEngine9SaveStateERNS_13StateRecorderE(ptr noundef nonnull align 8 dereferenceable(52) %8, ptr noundef nonnull align 8 dereferenceable(18) %1)
  %9 = getelementptr inbounds i8, ptr %0, i64 88
  tail call void @_ZNK3JPH19VehicleTransmission9SaveStateERNS_13StateRecorderE(ptr noundef nonnull align 8 dereferenceable(100) %9, ptr noundef nonnull align 8 dereferenceable(18) %1)
  %.0.ptr = getelementptr inbounds i8, ptr %0, i64 192
  tail call void @_ZNK3JPH12VehicleTrack9SaveStateERNS_13StateRecorderE(ptr noundef nonnull align 8 dereferenceable(52) %.0.ptr, ptr noundef nonnull align 8 dereferenceable(18) %1)
  %.0.ptr.1 = getelementptr inbounds i8, ptr %0, i64 248
  tail call void @_ZNK3JPH12VehicleTrack9SaveStateERNS_13StateRecorderE(ptr noundef nonnull align 8 dereferenceable(52) %.0.ptr.1, ptr noundef nonnull align 8 dereferenceable(18) %1)
  ret void
}

declare void @_ZNK3JPH13VehicleEngine9SaveStateERNS_13StateRecorderE(ptr noundef nonnull align 8 dereferenceable(52), ptr noundef nonnull align 8 dereferenceable(18)) local_unnamed_addr #1

declare void @_ZNK3JPH19VehicleTransmission9SaveStateERNS_13StateRecorderE(ptr noundef nonnull align 8 dereferenceable(100), ptr noundef nonnull align 8 dereferenceable(18)) local_unnamed_addr #1

declare void @_ZNK3JPH12VehicleTrack9SaveStateERNS_13StateRecorderE(ptr noundef nonnull align 8 dereferenceable(52), ptr noundef nonnull align 8 dereferenceable(18)) 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