; LLVM IR from erincatto/box2d :: samples/car.ll (ZN3CarC2Ev)

; 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.b2BodyId = type { i32, i16, i16 }
%struct.b2JointId = type { i32, i16, i16 }
%class.Car = type <{ %struct.b2BodyId, %struct.b2BodyId, %struct.b2BodyId, %struct.b2JointId, %struct.b2JointId, i8, [3 x i8] }>

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN3CarC2Ev(ptr noundef nonnull align 4 dereferenceable(41) %0) unnamed_addr #0 align 2 {
  %2 = alloca ptr, align 8
  %3 = alloca %struct.b2BodyId, align 4
  %4 = alloca %struct.b2BodyId, align 4
  %5 = alloca %struct.b2BodyId, align 4
  %6 = alloca %struct.b2JointId, align 4
  %7 = alloca %struct.b2JointId, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  %8 = load ptr, ptr %2, align 8
  %9 = getelementptr inbounds %class.Car, ptr %8, i32 0, i32 0
  %10 = getelementptr inbounds %class.Car, ptr %8, i32 0, i32 1
  %11 = getelementptr inbounds %class.Car, ptr %8, i32 0, i32 2
  %12 = getelementptr inbounds %class.Car, ptr %8, i32 0, i32 3
  %13 = getelementptr inbounds %class.Car, ptr %8, i32 0, i32 4
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #3
  %14 = getelementptr inbounds %struct.b2BodyId, ptr %3, i32 0, i32 0
  store i32 0, ptr %14, align 4, !tbaa !9
  %15 = getelementptr inbounds %struct.b2BodyId, ptr %3, i32 0, i32 1
  store i16 0, ptr %15, align 4, !tbaa !13
  %16 = getelementptr inbounds %struct.b2BodyId, ptr %3, i32 0, i32 2
  store i16 0, ptr %16, align 2, !tbaa !14
  %17 = getelementptr inbounds %class.Car, ptr %8, i32 0, i32 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %17, ptr align 4 %3, i64 8, i1 false), !tbaa.struct !15
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #3
  %18 = getelementptr inbounds %struct.b2BodyId, ptr %4, i32 0, i32 0
  store i32 0, ptr %18, align 4, !tbaa !9
  %19 = getelementptr inbounds %struct.b2BodyId, ptr %4, i32 0, i32 1
  store i16 0, ptr %19, align 4, !tbaa !13
  %20 = getelementptr inbounds %struct.b2BodyId, ptr %4, i32 0, i32 2
  store i16 0, ptr %20, align 2, !tbaa !14
  %21 = getelementptr inbounds %class.Car, ptr %8, i32 0, i32 1
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %21, ptr align 4 %4, i64 8, i1 false), !tbaa.struct !15
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #3
  %22 = getelementptr inbounds %struct.b2BodyId, ptr %5, i32 0, i32 0
  store i32 0, ptr %22, align 4, !tbaa !9
  %23 = getelementptr inbounds %struct.b2BodyId, ptr %5, i32 0, i32 1
  store i16 0, ptr %23, align 4, !tbaa !13
  %24 = getelementptr inbounds %struct.b2BodyId, ptr %5, i32 0, i32 2
  store i16 0, ptr %24, align 2, !tbaa !14
  %25 = getelementptr inbounds %class.Car, ptr %8, i32 0, i32 2
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %25, ptr align 4 %5, i64 8, i1 false), !tbaa.struct !15
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #3
  %26 = getelementptr inbounds %struct.b2JointId, ptr %6, i32 0, i32 0
  store i32 0, ptr %26, align 4, !tbaa !18
  %27 = getelementptr inbounds %struct.b2JointId, ptr %6, i32 0, i32 1
  store i16 0, ptr %27, align 4, !tbaa !20
  %28 = getelementptr inbounds %struct.b2JointId, ptr %6, i32 0, i32 2
  store i16 0, ptr %28, align 2, !tbaa !21
  %29 = getelementptr inbounds %class.Car, ptr %8, i32 0, i32 3
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %29, ptr align 4 %6, i64 8, i1 false), !tbaa.struct !15
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #3
  %30 = getelementptr inbounds %struct.b2JointId, ptr %7, i32 0, i32 0
  store i32 0, ptr %30, align 4, !tbaa !18
  %31 = getelementptr inbounds %struct.b2JointId, ptr %7, i32 0, i32 1
  store i16 0, ptr %31, align 4, !tbaa !20
  %32 = getelementptr inbounds %struct.b2JointId, ptr %7, i32 0, i32 2
  store i16 0, ptr %32, align 2, !tbaa !21
  %33 = getelementptr inbounds %class.Car, ptr %8, i32 0, i32 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %33, ptr align 4 %7, i64 8, i1 false), !tbaa.struct !15
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  %34 = getelementptr inbounds %class.Car, ptr %8, i32 0, i32 5
  store i8 0, ptr %34, align 4, !tbaa !22
  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: 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) #2

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

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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, !11, i64 0}
!10 = !{!"_ZTS8b2BodyId", !11, i64 0, !12, i64 4, !12, i64 6}
!11 = !{!"int", !7, i64 0}
!12 = !{!"short", !7, i64 0}
!13 = !{!10, !12, i64 4}
!14 = !{!10, !12, i64 6}
!15 = !{i64 0, i64 4, !16, i64 4, i64 2, !17, i64 6, i64 2, !17}
!16 = !{!11, !11, i64 0}
!17 = !{!12, !12, i64 0}
!18 = !{!19, !11, i64 0}
!19 = !{!"_ZTS9b2JointId", !11, i64 0, !12, i64 4, !12, i64 6}
!20 = !{!19, !12, i64 4}
!21 = !{!19, !12, i64 6}
!22 = !{!23, !24, i64 40}
!23 = !{!"_ZTS3Car", !10, i64 0, !10, i64 8, !10, i64 16, !19, i64 24, !19, i64 32, !24, i64 40}
!24 = !{!"bool", !7, 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 nofree norecurse nosync nounwind willreturn memory(argmem: write) uwtable
define dso_local void @_ZN3CarC2Ev(ptr nocapture noundef nonnull writeonly align 4 dereferenceable(41) %0) unnamed_addr #0 align 2 {
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(41) %0, i8 0, i64 41, i1 false)
  ret void
}

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #1

attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write) 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: write) }

!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,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,MemCpyOptPass,PostOrderFunctionAttrsPass,SROAPass,TailCallElimPass