; LLVM IR from mtsamis/box2d-optimized :: src/dynamics/b2_wheel_joint.ll (ZNK12b2WheelJoint16GetReactionForceEf)

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

%struct.b2Vec2 = type { float, float }
%class.b2WheelJoint = type <{ %class.b2Joint, %struct.b2Vec2, %struct.b2Vec2, %struct.b2Vec2, %struct.b2Vec2, float, float, float, float, float, float, float, float, float, float, i8, i8, [2 x i8], float, float, i32, i32, %struct.b2Vec2, %struct.b2Vec2, float, float, float, float, %struct.b2Vec2, %struct.b2Vec2, float, float, float, float, float, float, float, float, float, float, [4 x i8] }>
%class.b2Joint = type { ptr, i32, ptr, ptr, %struct.b2JointEdge, %struct.b2JointEdge, ptr, ptr, i32, i8, i8, %struct.b2JointUserData }
%struct.b2JointEdge = type { ptr, ptr, ptr, ptr }
%struct.b2JointUserData = type { i64 }

; 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: inlinehint mustprogress uwtable
declare dso_local <2 x float> @_ZplRK6b2Vec2S1_(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(8)) #1

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local <2 x float> @_ZmlfRK6b2Vec2(float noundef, ptr noundef nonnull align 4 dereferenceable(8)) #1

; Function Attrs: mustprogress uwtable
define dso_local <2 x float> @_ZNK12b2WheelJoint16GetReactionForceEf(ptr noundef nonnull align 8 dereferenceable(308) %0, float noundef %1) unnamed_addr #2 align 2 {
  %3 = alloca %struct.b2Vec2, align 4
  %4 = alloca ptr, align 8
  %5 = alloca float, align 4
  %6 = alloca %struct.b2Vec2, align 4
  %7 = alloca %struct.b2Vec2, align 4
  %8 = alloca %struct.b2Vec2, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store float %1, ptr %5, align 4, !tbaa !9
  %9 = load ptr, ptr %4, align 8
  %10 = load float, ptr %5, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #3
  %11 = getelementptr inbounds %class.b2WheelJoint, ptr %9, i32 0, i32 5
  %12 = load float, ptr %11, align 8, !tbaa !11
  %13 = getelementptr inbounds %class.b2WheelJoint, ptr %9, i32 0, i32 29
  %14 = call <2 x float> @_ZmlfRK6b2Vec2(float noundef %12, ptr noundef nonnull align 4 dereferenceable(8) %13)
  store <2 x float> %14, ptr %7, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #3
  %15 = getelementptr inbounds %class.b2WheelJoint, ptr %9, i32 0, i32 7
  %16 = load float, ptr %15, align 8, !tbaa !21
  %17 = getelementptr inbounds %class.b2WheelJoint, ptr %9, i32 0, i32 8
  %18 = load float, ptr %17, align 4, !tbaa !22
  %19 = fadd float %16, %18
  %20 = getelementptr inbounds %class.b2WheelJoint, ptr %9, i32 0, i32 9
  %21 = load float, ptr %20, align 8, !tbaa !23
  %22 = fsub float %19, %21
  %23 = getelementptr inbounds %class.b2WheelJoint, ptr %9, i32 0, i32 28
  %24 = call <2 x float> @_ZmlfRK6b2Vec2(float noundef %22, ptr noundef nonnull align 4 dereferenceable(8) %23)
  store <2 x float> %24, ptr %8, align 4
  %25 = call <2 x float> @_ZplRK6b2Vec2S1_(ptr noundef nonnull align 4 dereferenceable(8) %7, ptr noundef nonnull align 4 dereferenceable(8) %8)
  store <2 x float> %25, ptr %6, align 4
  %26 = call <2 x float> @_ZmlfRK6b2Vec2(float noundef %10, ptr noundef nonnull align 4 dereferenceable(8) %6)
  store <2 x float> %26, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #3
  %27 = load <2 x float>, ptr %3, align 4
  ret <2 x float> %27
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { inlinehint mustprogress uwtable "min-legal-vector-width"="64" "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 uwtable "min-legal-vector-width"="64" "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"}
!9 = !{!10, !10, i64 0}
!10 = !{!"float", !7, i64 0}
!11 = !{!12, !10, i64 160}
!12 = !{!"_ZTS12b2WheelJoint", !13, i64 0, !20, i64 128, !20, i64 136, !20, i64 144, !20, i64 152, !10, i64 160, !10, i64 164, !10, i64 168, !10, i64 172, !10, i64 176, !10, i64 180, !10, i64 184, !10, i64 188, !10, i64 192, !10, i64 196, !17, i64 200, !17, i64 201, !10, i64 204, !10, i64 208, !16, i64 212, !16, i64 216, !20, i64 220, !20, i64 228, !10, i64 236, !10, i64 240, !10, i64 244, !10, i64 248, !20, i64 252, !20, i64 260, !10, i64 268, !10, i64 272, !10, i64 276, !10, i64 280, !10, i64 284, !10, i64 288, !10, i64 292, !10, i64 296, !10, i64 300, !10, i64 304}
!13 = !{!"_ZTS7b2Joint", !14, i64 8, !6, i64 16, !6, i64 24, !15, i64 32, !15, i64 64, !6, i64 96, !6, i64 104, !16, i64 112, !17, i64 116, !17, i64 117, !18, i64 120}
!14 = !{!"_ZTS11b2JointType", !7, i64 0}
!15 = !{!"_ZTS11b2JointEdge", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!16 = !{!"int", !7, i64 0}
!17 = !{!"bool", !7, i64 0}
!18 = !{!"_ZTS15b2JointUserData", !19, i64 0}
!19 = !{!"long", !7, i64 0}
!20 = !{!"_ZTS6b2Vec2", !10, i64 0, !10, i64 4}
!21 = !{!12, !10, i64 168}
!22 = !{!12, !10, i64 172}
!23 = !{!12, !10, i64 176}


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

%struct.b2Vec2 = type { float, float }

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local <2 x float> @_ZplRK6b2Vec2S1_(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(8)) local_unnamed_addr #1

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local <2 x float> @_ZmlfRK6b2Vec2(float noundef, ptr noundef nonnull align 4 dereferenceable(8)) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
define dso_local <2 x float> @_ZNK12b2WheelJoint16GetReactionForceEf(ptr noundef nonnull align 8 dereferenceable(308) %0, float noundef %1) unnamed_addr #2 align 2 {
  %3 = alloca %struct.b2Vec2, align 8
  %4 = alloca %struct.b2Vec2, align 8
  %5 = alloca %struct.b2Vec2, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #3
  %6 = getelementptr inbounds i8, ptr %0, i64 160
  %7 = load float, ptr %6, align 8, !tbaa !5
  %8 = getelementptr inbounds i8, ptr %0, i64 260
  %9 = tail call <2 x float> @_ZmlfRK6b2Vec2(float noundef %7, ptr noundef nonnull align 4 dereferenceable(8) %8)
  store <2 x float> %9, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #3
  %10 = getelementptr inbounds i8, ptr %0, i64 168
  %11 = load float, ptr %10, align 8, !tbaa !19
  %12 = getelementptr inbounds i8, ptr %0, i64 172
  %13 = load float, ptr %12, align 4, !tbaa !20
  %14 = fadd float %11, %13
  %15 = getelementptr inbounds i8, ptr %0, i64 176
  %16 = load float, ptr %15, align 8, !tbaa !21
  %17 = fsub float %14, %16
  %18 = getelementptr inbounds i8, ptr %0, i64 252
  %19 = tail call <2 x float> @_ZmlfRK6b2Vec2(float noundef %17, ptr noundef nonnull align 4 dereferenceable(8) %18)
  store <2 x float> %19, ptr %5, align 8
  %20 = call <2 x float> @_ZplRK6b2Vec2S1_(ptr noundef nonnull align 4 dereferenceable(8) %4, ptr noundef nonnull align 4 dereferenceable(8) %5)
  store <2 x float> %20, ptr %3, align 8
  %21 = call <2 x float> @_ZmlfRK6b2Vec2(float noundef %1, ptr noundef nonnull align 4 dereferenceable(8) %3)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #3
  ret <2 x float> %21
}

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { inlinehint mustprogress uwtable "min-legal-vector-width"="64" "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 uwtable "min-legal-vector-width"="64" "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, !18, i64 160}
!6 = !{!"_ZTS12b2WheelJoint", !7, i64 0, !17, i64 128, !17, i64 136, !17, i64 144, !17, i64 152, !18, i64 160, !18, i64 164, !18, i64 168, !18, i64 172, !18, i64 176, !18, i64 180, !18, i64 184, !18, i64 188, !18, i64 192, !18, i64 196, !14, i64 200, !14, i64 201, !18, i64 204, !18, i64 208, !13, i64 212, !13, i64 216, !17, i64 220, !17, i64 228, !18, i64 236, !18, i64 240, !18, i64 244, !18, i64 248, !17, i64 252, !17, i64 260, !18, i64 268, !18, i64 272, !18, i64 276, !18, i64 280, !18, i64 284, !18, i64 288, !18, i64 292, !18, i64 296, !18, i64 300, !18, i64 304}
!7 = !{!"_ZTS7b2Joint", !8, i64 8, !11, i64 16, !11, i64 24, !12, i64 32, !12, i64 64, !11, i64 96, !11, i64 104, !13, i64 112, !14, i64 116, !14, i64 117, !15, i64 120}
!8 = !{!"_ZTS11b2JointType", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = !{!"any pointer", !9, i64 0}
!12 = !{!"_ZTS11b2JointEdge", !11, i64 0, !11, i64 8, !11, i64 16, !11, i64 24}
!13 = !{!"int", !9, i64 0}
!14 = !{!"bool", !9, i64 0}
!15 = !{!"_ZTS15b2JointUserData", !16, i64 0}
!16 = !{!"long", !9, i64 0}
!17 = !{!"_ZTS6b2Vec2", !18, i64 0, !18, i64 4}
!18 = !{!"float", !9, i64 0}
!19 = !{!6, !18, i64 168}
!20 = !{!6, !18, i64 172}
!21 = !{!6, !18, i64 176}


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