; LLVM IR from erincatto/box2d-lite :: src/Joint.ll (ZN5Joint3SetEP4BodyS1_RK4Vec2)

; 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.Mat22 = type { %struct.Vec2, %struct.Vec2 }
%struct.Vec2 = type { float, float }
%struct.Joint = type { %struct.Mat22, %struct.Vec2, %struct.Vec2, %struct.Vec2, %struct.Vec2, %struct.Vec2, %struct.Vec2, ptr, ptr, float, float }
%struct.Body = type { %struct.Vec2, float, %struct.Vec2, float, %struct.Vec2, float, %struct.Vec2, float, float, float, float, float }

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN5Joint3SetEP4BodyS1_RK4Vec2(ptr noundef nonnull align 8 dereferenceable(88) %0, ptr noundef %1, ptr noundef %2, ptr noundef nonnull align 4 dereferenceable(8) %3) #0 align 2 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca %struct.Mat22, align 4
  %10 = alloca %struct.Mat22, align 4
  %11 = alloca %struct.Mat22, align 4
  %12 = alloca %struct.Mat22, align 4
  %13 = alloca %struct.Vec2, align 4
  %14 = alloca %struct.Vec2, align 4
  %15 = alloca %struct.Vec2, align 4
  %16 = alloca %struct.Vec2, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store ptr %2, ptr %7, align 8, !tbaa !5
  store ptr %3, ptr %8, align 8, !tbaa !5
  %17 = load ptr, ptr %5, align 8
  %18 = load ptr, ptr %6, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct.Joint, ptr %17, i32 0, i32 7
  store ptr %18, ptr %19, align 8, !tbaa !9
  %20 = load ptr, ptr %7, align 8, !tbaa !5
  %21 = getelementptr inbounds %struct.Joint, ptr %17, i32 0, i32 8
  store ptr %20, ptr %21, align 8, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 16, ptr %9) #6
  %22 = getelementptr inbounds %struct.Joint, ptr %17, i32 0, i32 7
  %23 = load ptr, ptr %22, align 8, !tbaa !9
  %24 = getelementptr inbounds %struct.Body, ptr %23, i32 0, i32 1
  %25 = load float, ptr %24, align 4, !tbaa !15
  call void @_ZN5Mat22C2Ef(ptr noundef nonnull align 4 dereferenceable(16) %9, float noundef %25)
  call void @llvm.lifetime.start.p0(i64 16, ptr %10) #6
  %26 = getelementptr inbounds %struct.Joint, ptr %17, i32 0, i32 8
  %27 = load ptr, ptr %26, align 8, !tbaa !14
  %28 = getelementptr inbounds %struct.Body, ptr %27, i32 0, i32 1
  %29 = load float, ptr %28, align 4, !tbaa !15
  call void @_ZN5Mat22C2Ef(ptr noundef nonnull align 4 dereferenceable(16) %10, float noundef %29)
  call void @llvm.lifetime.start.p0(i64 16, ptr %11) #6
  %30 = call { <2 x float>, <2 x float> } @_ZNK5Mat229TransposeEv(ptr noundef nonnull align 4 dereferenceable(16) %9)
  %31 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %11, i32 0, i32 0
  %32 = extractvalue { <2 x float>, <2 x float> } %30, 0
  store <2 x float> %32, ptr %31, align 4
  %33 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %11, i32 0, i32 1
  %34 = extractvalue { <2 x float>, <2 x float> } %30, 1
  store <2 x float> %34, ptr %33, align 4
  call void @llvm.lifetime.start.p0(i64 16, ptr %12) #6
  %35 = call { <2 x float>, <2 x float> } @_ZNK5Mat229TransposeEv(ptr noundef nonnull align 4 dereferenceable(16) %10)
  %36 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %12, i32 0, i32 0
  %37 = extractvalue { <2 x float>, <2 x float> } %35, 0
  store <2 x float> %37, ptr %36, align 4
  %38 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %12, i32 0, i32 1
  %39 = extractvalue { <2 x float>, <2 x float> } %35, 1
  store <2 x float> %39, ptr %38, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #6
  %40 = load ptr, ptr %8, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct.Joint, ptr %17, i32 0, i32 7
  %42 = load ptr, ptr %41, align 8, !tbaa !9
  %43 = getelementptr inbounds %struct.Body, ptr %42, i32 0, i32 0
  %44 = call <2 x float> @_ZmiRK4Vec2S1_(ptr noundef nonnull align 4 dereferenceable(8) %40, ptr noundef nonnull align 4 dereferenceable(8) %43)
  store <2 x float> %44, ptr %14, align 4
  %45 = call <2 x float> @_ZmlRK5Mat22RK4Vec2(ptr noundef nonnull align 4 dereferenceable(16) %11, ptr noundef nonnull align 4 dereferenceable(8) %14)
  store <2 x float> %45, ptr %13, align 4
  %46 = getelementptr inbounds %struct.Joint, ptr %17, i32 0, i32 1
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %46, ptr align 4 %13, i64 8, i1 false), !tbaa.struct !17
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #6
  %47 = load ptr, ptr %8, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.Joint, ptr %17, i32 0, i32 8
  %49 = load ptr, ptr %48, align 8, !tbaa !14
  %50 = getelementptr inbounds %struct.Body, ptr %49, i32 0, i32 0
  %51 = call <2 x float> @_ZmiRK4Vec2S1_(ptr noundef nonnull align 4 dereferenceable(8) %47, ptr noundef nonnull align 4 dereferenceable(8) %50)
  store <2 x float> %51, ptr %16, align 4
  %52 = call <2 x float> @_ZmlRK5Mat22RK4Vec2(ptr noundef nonnull align 4 dereferenceable(16) %12, ptr noundef nonnull align 4 dereferenceable(8) %16)
  store <2 x float> %52, ptr %15, align 4
  %53 = getelementptr inbounds %struct.Joint, ptr %17, i32 0, i32 2
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %53, ptr align 4 %15, i64 8, i1 false), !tbaa.struct !17
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #6
  %54 = getelementptr inbounds %struct.Joint, ptr %17, i32 0, i32 6
  call void @_ZN4Vec23SetEff(ptr noundef nonnull align 4 dereferenceable(8) %54, float noundef 0.000000e+00, float noundef 0.000000e+00)
  %55 = getelementptr inbounds %struct.Joint, ptr %17, i32 0, i32 10
  store float 0.000000e+00, ptr %55, align 4, !tbaa !19
  %56 = getelementptr inbounds %struct.Joint, ptr %17, i32 0, i32 9
  store float 0x3FC99999A0000000, ptr %56, align 8, !tbaa !20
  call void @llvm.lifetime.end.p0(i64 16, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %9) #6
  ret void
}

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN5Mat22C2Ef(ptr noundef nonnull align 4 dereferenceable(16), float noundef) unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local { <2 x float>, <2 x float> } @_ZNK5Mat229TransposeEv(ptr noundef nonnull align 4 dereferenceable(16)) #2 align 2

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

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #4

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN4Vec23SetEff(ptr noundef nonnull align 4 dereferenceable(8), float noundef, float noundef) #5 align 2

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 = { 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 #4 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { 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 #6 = { 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, !6, i64 64}
!10 = !{!"_ZTS5Joint", !11, i64 0, !12, i64 16, !12, i64 24, !12, i64 32, !12, i64 40, !12, i64 48, !12, i64 56, !6, i64 64, !6, i64 72, !13, i64 80, !13, i64 84}
!11 = !{!"_ZTS5Mat22", !12, i64 0, !12, i64 8}
!12 = !{!"_ZTS4Vec2", !13, i64 0, !13, i64 4}
!13 = !{!"float", !7, i64 0}
!14 = !{!10, !6, i64 72}
!15 = !{!16, !13, i64 8}
!16 = !{!"_ZTS4Body", !12, i64 0, !13, i64 8, !12, i64 12, !13, i64 20, !12, i64 24, !13, i64 32, !12, i64 36, !13, i64 44, !13, i64 48, !13, i64 52, !13, i64 56, !13, i64 60}
!17 = !{i64 0, i64 4, !18, i64 4, i64 4, !18}
!18 = !{!13, !13, i64 0}
!19 = !{!10, !13, i64 84}
!20 = !{!10, !13, i64 80}


; 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.Mat22 = type { %struct.Vec2, %struct.Vec2 }
%struct.Vec2 = type { float, float }

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN5Joint3SetEP4BodyS1_RK4Vec2(ptr noundef nonnull align 8 dereferenceable(88) %0, ptr noundef %1, ptr noundef %2, ptr noundef nonnull align 4 dereferenceable(8) %3) local_unnamed_addr #0 align 2 {
  %5 = alloca %struct.Mat22, align 4
  %6 = alloca %struct.Mat22, align 4
  %7 = alloca %struct.Mat22, align 8
  %8 = alloca %struct.Mat22, align 8
  %9 = alloca %struct.Vec2, align 8
  %10 = alloca %struct.Vec2, align 8
  %11 = getelementptr inbounds i8, ptr %0, i64 64
  store ptr %1, ptr %11, align 8, !tbaa !5
  %12 = getelementptr inbounds i8, ptr %0, i64 72
  store ptr %2, ptr %12, align 8, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %5) #5
  %13 = getelementptr inbounds i8, ptr %1, i64 8
  %14 = load float, ptr %13, align 4, !tbaa !14
  call void @_ZN5Mat22C2Ef(ptr noundef nonnull align 4 dereferenceable(16) %5, float noundef %14)
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %6) #5
  %15 = load ptr, ptr %12, align 8, !tbaa !13
  %16 = getelementptr inbounds i8, ptr %15, i64 8
  %17 = load float, ptr %16, align 4, !tbaa !14
  call void @_ZN5Mat22C2Ef(ptr noundef nonnull align 4 dereferenceable(16) %6, float noundef %17)
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %7) #5
  %18 = call { <2 x float>, <2 x float> } @_ZNK5Mat229TransposeEv(ptr noundef nonnull align 4 dereferenceable(16) %5)
  %19 = extractvalue { <2 x float>, <2 x float> } %18, 0
  store <2 x float> %19, ptr %7, align 8
  %20 = getelementptr inbounds i8, ptr %7, i64 8
  %21 = extractvalue { <2 x float>, <2 x float> } %18, 1
  store <2 x float> %21, ptr %20, align 8
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %8) #5
  %22 = call { <2 x float>, <2 x float> } @_ZNK5Mat229TransposeEv(ptr noundef nonnull align 4 dereferenceable(16) %6)
  %23 = extractvalue { <2 x float>, <2 x float> } %22, 0
  store <2 x float> %23, ptr %8, align 8
  %24 = getelementptr inbounds i8, ptr %8, i64 8
  %25 = extractvalue { <2 x float>, <2 x float> } %22, 1
  store <2 x float> %25, ptr %24, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #5
  %26 = load ptr, ptr %11, align 8, !tbaa !5
  %27 = call <2 x float> @_ZmiRK4Vec2S1_(ptr noundef nonnull align 4 dereferenceable(8) %3, ptr noundef nonnull align 4 dereferenceable(8) %26)
  store <2 x float> %27, ptr %9, align 8
  %28 = call <2 x float> @_ZmlRK5Mat22RK4Vec2(ptr noundef nonnull align 4 dereferenceable(16) %7, ptr noundef nonnull align 4 dereferenceable(8) %9)
  %29 = getelementptr inbounds i8, ptr %0, i64 16
  store <2 x float> %28, ptr %29, align 8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %10) #5
  %30 = load ptr, ptr %12, align 8, !tbaa !13
  %31 = call <2 x float> @_ZmiRK4Vec2S1_(ptr noundef nonnull align 4 dereferenceable(8) %3, ptr noundef nonnull align 4 dereferenceable(8) %30)
  store <2 x float> %31, ptr %10, align 8
  %32 = call <2 x float> @_ZmlRK5Mat22RK4Vec2(ptr noundef nonnull align 4 dereferenceable(16) %8, ptr noundef nonnull align 4 dereferenceable(8) %10)
  %33 = getelementptr inbounds i8, ptr %0, i64 24
  store <2 x float> %32, ptr %33, align 8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #5
  %34 = getelementptr inbounds i8, ptr %0, i64 56
  call void @_ZN4Vec23SetEff(ptr noundef nonnull align 4 dereferenceable(8) %34, float noundef 0.000000e+00, float noundef 0.000000e+00)
  %35 = getelementptr inbounds i8, ptr %0, i64 80
  store <2 x float> <float 0x3FC99999A0000000, float 0.000000e+00>, ptr %35, align 8, !tbaa !16
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %8) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %7) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %6) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %5) #5
  ret void
}

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN5Mat22C2Ef(ptr noundef nonnull align 4 dereferenceable(16), float noundef) unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local { <2 x float>, <2 x float> } @_ZNK5Mat229TransposeEv(ptr noundef nonnull align 4 dereferenceable(16)) local_unnamed_addr #2 align 2

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN4Vec23SetEff(ptr noundef nonnull align 4 dereferenceable(8), float noundef, float noundef) local_unnamed_addr #4 align 2

attributes #0 = { 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 = { 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 #4 = { 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 #5 = { 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, !12, i64 64}
!6 = !{!"_ZTS5Joint", !7, i64 0, !8, i64 16, !8, i64 24, !8, i64 32, !8, i64 40, !8, i64 48, !8, i64 56, !12, i64 64, !12, i64 72, !9, i64 80, !9, i64 84}
!7 = !{!"_ZTS5Mat22", !8, i64 0, !8, i64 8}
!8 = !{!"_ZTS4Vec2", !9, i64 0, !9, i64 4}
!9 = !{!"float", !10, i64 0}
!10 = !{!"omnipotent char", !11, i64 0}
!11 = !{!"Simple C++ TBAA"}
!12 = !{!"any pointer", !10, i64 0}
!13 = !{!6, !12, i64 72}
!14 = !{!15, !9, i64 8}
!15 = !{!"_ZTS4Body", !8, i64 0, !9, i64 8, !8, i64 12, !9, i64 20, !8, i64 24, !9, i64 32, !8, i64 36, !9, i64 44, !9, i64 48, !9, i64 52, !9, i64 56, !9, i64 60}
!16 = !{!9, !9, i64 0}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,SLPVectorizerPass,SROAPass