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

; 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.b2FixtureDef = type { ptr, %struct.b2FixtureUserData, float, float, float, float, i8, %struct.b2Filter }
%struct.b2FixtureUserData = type { i64 }
%struct.b2Filter = type { i16, i16, i16 }
%class.b2Fixture = type <{ float, [4 x i8], ptr, ptr, ptr, %struct.b2AABB, float, float, float, %struct.b2Filter, i8, [5 x i8], %struct.b2FixtureUserData, i32, [4 x i8] }>
%struct.b2AABB = type { %struct.b2Vec2, %struct.b2Vec2 }
%struct.b2Vec2 = type { float, float }

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN9b2Fixture6CreateEP16b2BlockAllocatorP6b2BodyPK12b2FixtureDef(ptr noundef nonnull align 8 dereferenceable(84) %0, ptr noundef %1, ptr noundef %2, ptr noundef %3) #0 align 2 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  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
  %9 = load ptr, ptr %5, align 8
  %10 = load ptr, ptr %8, align 8, !tbaa !5
  %11 = getelementptr inbounds %struct.b2FixtureDef, ptr %10, i32 0, i32 1
  %12 = getelementptr inbounds %class.b2Fixture, ptr %9, i32 0, i32 12
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %12, ptr align 8 %11, i64 8, i1 false), !tbaa.struct !9
  %13 = load ptr, ptr %8, align 8, !tbaa !5
  %14 = getelementptr inbounds %struct.b2FixtureDef, ptr %13, i32 0, i32 2
  %15 = load float, ptr %14, align 8, !tbaa !12
  %16 = getelementptr inbounds %class.b2Fixture, ptr %9, i32 0, i32 6
  store float %15, ptr %16, align 8, !tbaa !19
  %17 = load ptr, ptr %8, align 8, !tbaa !5
  %18 = getelementptr inbounds %struct.b2FixtureDef, ptr %17, i32 0, i32 3
  %19 = load float, ptr %18, align 4, !tbaa !24
  %20 = getelementptr inbounds %class.b2Fixture, ptr %9, i32 0, i32 7
  store float %19, ptr %20, align 4, !tbaa !25
  %21 = load ptr, ptr %8, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct.b2FixtureDef, ptr %21, i32 0, i32 4
  %23 = load float, ptr %22, align 8, !tbaa !26
  %24 = getelementptr inbounds %class.b2Fixture, ptr %9, i32 0, i32 8
  store float %23, ptr %24, align 8, !tbaa !27
  %25 = load ptr, ptr %7, align 8, !tbaa !5
  %26 = getelementptr inbounds %class.b2Fixture, ptr %9, i32 0, i32 3
  store ptr %25, ptr %26, align 8, !tbaa !28
  %27 = getelementptr inbounds %class.b2Fixture, ptr %9, i32 0, i32 2
  store ptr null, ptr %27, align 8, !tbaa !29
  %28 = load ptr, ptr %8, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.b2FixtureDef, ptr %28, i32 0, i32 7
  %30 = getelementptr inbounds %class.b2Fixture, ptr %9, i32 0, i32 9
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %30, ptr align 2 %29, i64 6, i1 false), !tbaa.struct !30
  %31 = load ptr, ptr %8, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.b2FixtureDef, ptr %31, i32 0, i32 6
  %33 = load i8, ptr %32, align 8, !tbaa !32, !range !33, !noundef !34
  %34 = trunc i8 %33 to i1
  %35 = getelementptr inbounds %class.b2Fixture, ptr %9, i32 0, i32 10
  %36 = zext i1 %34 to i8
  store i8 %36, ptr %35, align 2, !tbaa !35
  %37 = load ptr, ptr %8, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.b2FixtureDef, ptr %37, i32 0, i32 0
  %39 = load ptr, ptr %38, align 8, !tbaa !36
  %40 = load ptr, ptr %6, align 8, !tbaa !5
  %41 = load ptr, ptr %39, align 8, !tbaa !37
  %42 = getelementptr inbounds ptr, ptr %41, i64 2
  %43 = load ptr, ptr %42, align 8
  %44 = call noundef ptr %43(ptr noundef nonnull align 8 dereferenceable(16) %39, ptr noundef %40)
  %45 = getelementptr inbounds %class.b2Fixture, ptr %9, i32 0, i32 4
  store ptr %44, ptr %45, align 8, !tbaa !39
  %46 = load ptr, ptr %8, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.b2FixtureDef, ptr %46, i32 0, i32 5
  %48 = load float, ptr %47, align 4, !tbaa !40
  %49 = getelementptr inbounds %class.b2Fixture, ptr %9, i32 0, i32 0
  store float %48, ptr %49, align 8, !tbaa !41
  ret void
}

; 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) #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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }

!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 = !{i64 0, i64 8, !10}
!10 = !{!11, !11, i64 0}
!11 = !{!"long", !7, i64 0}
!12 = !{!13, !15, i64 16}
!13 = !{!"_ZTS12b2FixtureDef", !6, i64 0, !14, i64 8, !15, i64 16, !15, i64 20, !15, i64 24, !15, i64 28, !16, i64 32, !17, i64 34}
!14 = !{!"_ZTS17b2FixtureUserData", !11, i64 0}
!15 = !{!"float", !7, i64 0}
!16 = !{!"bool", !7, i64 0}
!17 = !{!"_ZTS8b2Filter", !18, i64 0, !18, i64 2, !18, i64 4}
!18 = !{!"short", !7, i64 0}
!19 = !{!20, !15, i64 48}
!20 = !{!"_ZTS9b2Fixture", !15, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !21, i64 32, !15, i64 48, !15, i64 52, !15, i64 56, !17, i64 60, !16, i64 66, !14, i64 72, !23, i64 80}
!21 = !{!"_ZTS6b2AABB", !22, i64 0, !22, i64 8}
!22 = !{!"_ZTS6b2Vec2", !15, i64 0, !15, i64 4}
!23 = !{!"int", !7, i64 0}
!24 = !{!13, !15, i64 20}
!25 = !{!20, !15, i64 52}
!26 = !{!13, !15, i64 24}
!27 = !{!20, !15, i64 56}
!28 = !{!20, !6, i64 16}
!29 = !{!20, !6, i64 8}
!30 = !{i64 0, i64 2, !31, i64 2, i64 2, !31, i64 4, i64 2, !31}
!31 = !{!18, !18, i64 0}
!32 = !{!13, !16, i64 32}
!33 = !{i8 0, i8 2}
!34 = !{}
!35 = !{!20, !16, i64 66}
!36 = !{!13, !6, i64 0}
!37 = !{!38, !38, i64 0}
!38 = !{!"vtable pointer", !8, i64 0}
!39 = !{!20, !6, i64 24}
!40 = !{!13, !15, i64 28}
!41 = !{!20, !15, i64 0}


; 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 @_ZN9b2Fixture6CreateEP16b2BlockAllocatorP6b2BodyPK12b2FixtureDef(ptr nocapture noundef nonnull writeonly align 8 dereferenceable(84) %0, ptr noundef %1, ptr noundef %2, ptr nocapture noundef readonly %3) local_unnamed_addr #0 align 2 {
  %5 = getelementptr inbounds i8, ptr %3, i64 8
  %6 = getelementptr inbounds i8, ptr %0, i64 72
  %7 = load i64, ptr %5, align 8, !tbaa !5
  store i64 %7, ptr %6, align 8, !tbaa !5
  %8 = getelementptr inbounds i8, ptr %3, i64 16
  %9 = getelementptr inbounds i8, ptr %0, i64 48
  %10 = load <2 x float>, ptr %8, align 8, !tbaa !9
  store <2 x float> %10, ptr %9, align 8, !tbaa !9
  %11 = getelementptr inbounds i8, ptr %3, i64 24
  %12 = load float, ptr %11, align 8, !tbaa !11
  %13 = getelementptr inbounds i8, ptr %0, i64 56
  store float %12, ptr %13, align 8, !tbaa !18
  %14 = getelementptr inbounds i8, ptr %0, i64 16
  store ptr %2, ptr %14, align 8, !tbaa !23
  %15 = getelementptr inbounds i8, ptr %0, i64 8
  store ptr null, ptr %15, align 8, !tbaa !24
  %16 = getelementptr inbounds i8, ptr %3, i64 34
  %17 = getelementptr inbounds i8, ptr %0, i64 60
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(6) %17, ptr noundef nonnull align 2 dereferenceable(6) %16, i64 6, i1 false), !tbaa.struct !25
  %18 = getelementptr inbounds i8, ptr %3, i64 32
  %19 = load i8, ptr %18, align 8, !tbaa !27, !range !28, !noundef !29
  %20 = getelementptr inbounds i8, ptr %0, i64 66
  store i8 %19, ptr %20, align 2, !tbaa !30
  %21 = load ptr, ptr %3, align 8, !tbaa !31
  %22 = load ptr, ptr %21, align 8, !tbaa !32
  %23 = getelementptr inbounds i8, ptr %22, i64 16
  %24 = load ptr, ptr %23, align 8
  %25 = tail call noundef ptr %24(ptr noundef nonnull align 8 dereferenceable(16) %21, ptr noundef %1)
  %26 = getelementptr inbounds i8, ptr %0, i64 24
  store ptr %25, ptr %26, align 8, !tbaa !34
  %27 = getelementptr inbounds i8, ptr %3, i64 28
  %28 = load float, ptr %27, align 4, !tbaa !35
  store float %28, ptr %0, align 8, !tbaa !36
  ret void
}

; Function Attrs: mustprogress 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) #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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }

!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 = !{!"long", !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 24}
!12 = !{!"_ZTS12b2FixtureDef", !13, i64 0, !14, i64 8, !10, i64 16, !10, i64 20, !10, i64 24, !10, i64 28, !15, i64 32, !16, i64 34}
!13 = !{!"any pointer", !7, i64 0}
!14 = !{!"_ZTS17b2FixtureUserData", !6, i64 0}
!15 = !{!"bool", !7, i64 0}
!16 = !{!"_ZTS8b2Filter", !17, i64 0, !17, i64 2, !17, i64 4}
!17 = !{!"short", !7, i64 0}
!18 = !{!19, !10, i64 56}
!19 = !{!"_ZTS9b2Fixture", !10, i64 0, !13, i64 8, !13, i64 16, !13, i64 24, !20, i64 32, !10, i64 48, !10, i64 52, !10, i64 56, !16, i64 60, !15, i64 66, !14, i64 72, !22, i64 80}
!20 = !{!"_ZTS6b2AABB", !21, i64 0, !21, i64 8}
!21 = !{!"_ZTS6b2Vec2", !10, i64 0, !10, i64 4}
!22 = !{!"int", !7, i64 0}
!23 = !{!19, !13, i64 16}
!24 = !{!19, !13, i64 8}
!25 = !{i64 0, i64 2, !26, i64 2, i64 2, !26, i64 4, i64 2, !26}
!26 = !{!17, !17, i64 0}
!27 = !{!12, !15, i64 32}
!28 = !{i8 0, i8 2}
!29 = !{}
!30 = !{!19, !15, i64 66}
!31 = !{!12, !13, i64 0}
!32 = !{!33, !33, i64 0}
!33 = !{!"vtable pointer", !8, i64 0}
!34 = !{!19, !13, i64 24}
!35 = !{!12, !10, i64 28}
!36 = !{!19, !10, i64 0}


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