; LLVM IR from Simple-XX/SimplePhysicsEngine :: test/system_test/demo_old/RigidBodySimulation (cpair)

; 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.std::array.0" = type { [2 x i64] }
%"struct.clib::vec2" = type { double, double }
%"struct.clib::ccontact" = type { %"struct.clib::vec2", %"struct.clib::vec2", %"struct.clib::vec2", %"struct.std::array", %"struct.std::array.0", double, double, double, double, double, double }
%"struct.std::array" = type { [2 x i8] }

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4clib8ccontactC2ERKNS_12polygon_bodyEm(ptr noundef nonnull align 8 dereferenceable(120) %0, ptr noundef nonnull align 8 dereferenceable(192) %1, i64 noundef %2) unnamed_addr #0 align 2 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i64, align 8
  %7 = alloca %"struct.std::array.0", align 8
  %8 = alloca i8, align 1
  %9 = alloca %"struct.clib::vec2", align 8
  %10 = alloca %"struct.clib::vec2", align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store i64 %2, ptr %6, align 8, !tbaa !9
  %11 = load ptr, ptr %4, align 8
  %12 = getelementptr inbounds %"struct.clib::ccontact", ptr %11, i32 0, i32 0
  call void @_ZN4clib4vec2C1Ev(ptr noundef nonnull align 8 dereferenceable(16) %12)
  %13 = getelementptr inbounds %"struct.clib::ccontact", ptr %11, i32 0, i32 1
  call void @_ZN4clib4vec2C1Ev(ptr noundef nonnull align 8 dereferenceable(16) %13)
  %14 = getelementptr inbounds %"struct.clib::ccontact", ptr %11, i32 0, i32 2
  call void @_ZN4clib4vec2C1Ev(ptr noundef nonnull align 8 dereferenceable(16) %14)
  %15 = getelementptr inbounds %"struct.clib::ccontact", ptr %11, i32 0, i32 3
  %16 = getelementptr inbounds %"struct.clib::ccontact", ptr %11, i32 0, i32 4
  %17 = getelementptr inbounds %"struct.clib::ccontact", ptr %11, i32 0, i32 6
  store double 0.000000e+00, ptr %17, align 8, !tbaa !11
  %18 = getelementptr inbounds %"struct.clib::ccontact", ptr %11, i32 0, i32 7
  store double 0.000000e+00, ptr %18, align 8, !tbaa !17
  %19 = getelementptr inbounds %"struct.clib::ccontact", ptr %11, i32 0, i32 8
  store double 0.000000e+00, ptr %19, align 8, !tbaa !18
  %20 = getelementptr inbounds %"struct.clib::ccontact", ptr %11, i32 0, i32 9
  store double 0.000000e+00, ptr %20, align 8, !tbaa !19
  %21 = getelementptr inbounds %"struct.clib::ccontact", ptr %11, i32 0, i32 10
  store double 0.000000e+00, ptr %21, align 8, !tbaa !20
  call void @llvm.lifetime.start.p0(i64 16, ptr %7) #6
  %22 = getelementptr inbounds %"struct.std::array.0", ptr %7, i32 0, i32 0
  %23 = load i64, ptr %6, align 8, !tbaa !9
  store i64 %23, ptr %22, align 8, !tbaa !9
  %24 = getelementptr inbounds i64, ptr %22, i64 1
  %25 = load i64, ptr %6, align 8, !tbaa !9
  store i64 %25, ptr %24, align 8, !tbaa !9
  %26 = getelementptr inbounds %"struct.clib::ccontact", ptr %11, i32 0, i32 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %26, ptr align 8 %7, i64 16, i1 false), !tbaa.struct !21
  call void @llvm.lifetime.end.p0(i64 16, ptr %7) #6
  %27 = getelementptr inbounds %"struct.clib::ccontact", ptr %11, i32 0, i32 3
  %28 = call noundef ptr @_ZNSt5arrayIbLm2EE5beginEv(ptr noundef nonnull align 1 dereferenceable(2) %27) #7
  %29 = getelementptr inbounds %"struct.clib::ccontact", ptr %11, i32 0, i32 3
  %30 = call noundef ptr @_ZNSt5arrayIbLm2EE3endEv(ptr noundef nonnull align 1 dereferenceable(2) %29) #7
  call void @llvm.lifetime.start.p0(i64 1, ptr %8) #6
  store i8 0, ptr %8, align 1, !tbaa !23
  call void @_ZSt4fillIPbbEvT_S1_RKT0_(ptr noundef %28, ptr noundef %30, ptr noundef nonnull align 1 dereferenceable(1) %8)
  call void @llvm.lifetime.end.p0(i64 1, ptr %8) #6
  call void @llvm.lifetime.start.p0(i64 16, ptr %9) #6
  %31 = load ptr, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr %10) #6
  %32 = load ptr, ptr %5, align 8, !tbaa !5
  %33 = load i64, ptr %6, align 8, !tbaa !9
  %34 = call { double, double } @_ZNK4clib12polygon_bodyixEm(ptr noundef nonnull align 8 dereferenceable(192) %32, i64 noundef %33)
  %35 = getelementptr inbounds { double, double }, ptr %10, i32 0, i32 0
  %36 = extractvalue { double, double } %34, 0
  store double %36, ptr %35, align 8
  %37 = getelementptr inbounds { double, double }, ptr %10, i32 0, i32 1
  %38 = extractvalue { double, double } %34, 1
  store double %38, ptr %37, align 8
  %39 = call { double, double } @_ZNK4clib5cbody14local_to_worldERKNS_4vec2E(ptr noundef nonnull align 8 dereferenceable(168) %31, ptr noundef nonnull align 8 dereferenceable(16) %10)
  %40 = getelementptr inbounds { double, double }, ptr %9, i32 0, i32 0
  %41 = extractvalue { double, double } %39, 0
  store double %41, ptr %40, align 8
  %42 = getelementptr inbounds { double, double }, ptr %9, i32 0, i32 1
  %43 = extractvalue { double, double } %39, 1
  store double %43, ptr %42, align 8
  %44 = getelementptr inbounds %"struct.clib::ccontact", ptr %11, i32 0, i32 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %44, ptr align 8 %9, i64 16, i1 false), !tbaa.struct !25
  call void @llvm.lifetime.end.p0(i64 16, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %9) #6
  ret void
}

declare void @_ZN4clib4vec2C1Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #1

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

; 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) #3

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4fillIPbbEvT_S1_RKT0_(ptr noundef, ptr noundef, ptr noundef nonnull align 1 dereferenceable(1)) #4

; Function Attrs: mustprogress nounwind willreturn memory(none) uwtable
declare dso_local noundef ptr @_ZNSt5arrayIbLm2EE5beginEv(ptr noundef nonnull align 1 dereferenceable(2)) #5 align 2

; Function Attrs: mustprogress nounwind willreturn memory(none) uwtable
declare dso_local noundef ptr @_ZNSt5arrayIbLm2EE3endEv(ptr noundef nonnull align 1 dereferenceable(2)) #5 align 2

declare { double, double } @_ZNK4clib5cbody14local_to_worldERKNS_4vec2E(ptr noundef nonnull align 8 dereferenceable(168), ptr noundef nonnull align 8 dereferenceable(16)) #1

declare { double, double } @_ZNK4clib12polygon_bodyixEm(ptr noundef nonnull align 8 dereferenceable(192), i64 noundef) #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" }
attributes #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { inlinehint 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 #5 = { mustprogress nounwind willreturn memory(none) 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 }
attributes #7 = { nounwind willreturn memory(none) }

!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 = !{!"long", !7, i64 0}
!11 = !{!12, !14, i64 80}
!12 = !{!"_ZTSN4clib8ccontactE", !13, i64 0, !13, i64 16, !13, i64 32, !15, i64 48, !16, i64 56, !14, i64 72, !14, i64 80, !14, i64 88, !14, i64 96, !14, i64 104, !14, i64 112}
!13 = !{!"_ZTSN4clib4vec2E", !14, i64 0, !14, i64 8}
!14 = !{!"double", !7, i64 0}
!15 = !{!"_ZTSSt5arrayIbLm2EE", !7, i64 0}
!16 = !{!"_ZTSSt5arrayImLm2EE", !7, i64 0}
!17 = !{!12, !14, i64 88}
!18 = !{!12, !14, i64 96}
!19 = !{!12, !14, i64 104}
!20 = !{!12, !14, i64 112}
!21 = !{i64 0, i64 16, !22}
!22 = !{!7, !7, i64 0}
!23 = !{!24, !24, i64 0}
!24 = !{!"bool", !7, i64 0}
!25 = !{i64 0, i64 8, !26, i64 8, i64 8, !26}
!26 = !{!14, !14, 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"

%"struct.clib::vec2" = type { double, double }

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4clib8ccontactC2ERKNS_12polygon_bodyEm(ptr noundef nonnull align 8 dereferenceable(120) %0, ptr noundef nonnull align 8 dereferenceable(192) %1, i64 noundef %2) unnamed_addr #0 align 2 {
  %4 = alloca i8, align 1
  %5 = alloca %"struct.clib::vec2", align 8
  tail call void @_ZN4clib4vec2C1Ev(ptr noundef nonnull align 8 dereferenceable(16) %0)
  %6 = getelementptr inbounds i8, ptr %0, i64 16
  tail call void @_ZN4clib4vec2C1Ev(ptr noundef nonnull align 8 dereferenceable(16) %6)
  %7 = getelementptr inbounds i8, ptr %0, i64 32
  tail call void @_ZN4clib4vec2C1Ev(ptr noundef nonnull align 8 dereferenceable(16) %7)
  %8 = getelementptr inbounds i8, ptr %0, i64 80
  %9 = getelementptr inbounds i8, ptr %0, i64 56
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(40) %8, i8 0, i64 40, i1 false)
  store i64 %2, ptr %9, align 8
  %.sroa.42.0..sroa_idx = getelementptr inbounds i8, ptr %0, i64 64
  store i64 %2, ptr %.sroa.42.0..sroa_idx, align 8, !tbaa !5
  %10 = getelementptr inbounds i8, ptr %0, i64 48
  %11 = tail call noundef ptr @_ZNSt5arrayIbLm2EE5beginEv(ptr noundef nonnull align 1 dereferenceable(2) %10) #6
  %12 = tail call noundef ptr @_ZNSt5arrayIbLm2EE3endEv(ptr noundef nonnull align 1 dereferenceable(2) %10) #6
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %4) #7
  store i8 0, ptr %4, align 1, !tbaa !8
  call void @_ZSt4fillIPbbEvT_S1_RKT0_(ptr noundef %11, ptr noundef %12, ptr noundef nonnull align 1 dereferenceable(1) %4)
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %4) #7
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %5) #7
  %13 = call { double, double } @_ZNK4clib12polygon_bodyixEm(ptr noundef nonnull align 8 dereferenceable(192) %1, i64 noundef %2)
  %14 = extractvalue { double, double } %13, 0
  store double %14, ptr %5, align 8
  %15 = getelementptr inbounds i8, ptr %5, i64 8
  %16 = extractvalue { double, double } %13, 1
  store double %16, ptr %15, align 8
  %17 = call { double, double } @_ZNK4clib5cbody14local_to_worldERKNS_4vec2E(ptr noundef nonnull align 8 dereferenceable(168) %1, ptr noundef nonnull align 8 dereferenceable(16) %5)
  %18 = extractvalue { double, double } %17, 0
  %19 = extractvalue { double, double } %17, 1
  store double %18, ptr %0, align 8, !tbaa !10
  %.sroa.4.0..sroa_idx = getelementptr inbounds i8, ptr %0, i64 8
  store double %19, ptr %.sroa.4.0..sroa_idx, align 8, !tbaa !10
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %5) #7
  ret void
}

declare void @_ZN4clib4vec2C1Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #1

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4fillIPbbEvT_S1_RKT0_(ptr noundef, ptr noundef, ptr noundef nonnull align 1 dereferenceable(1)) local_unnamed_addr #3

; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
declare dso_local noundef ptr @_ZNSt5arrayIbLm2EE5beginEv(ptr noundef nonnull align 1 dereferenceable(2)) local_unnamed_addr #4 align 2

; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
declare dso_local noundef ptr @_ZNSt5arrayIbLm2EE3endEv(ptr noundef nonnull align 1 dereferenceable(2)) local_unnamed_addr #4 align 2

declare { double, double } @_ZNK4clib5cbody14local_to_worldERKNS_4vec2E(ptr noundef nonnull align 8 dereferenceable(168), ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #1

declare { double, double } @_ZNK4clib12polygon_bodyixEm(ptr noundef nonnull align 8 dereferenceable(192), i64 noundef) local_unnamed_addr #1

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

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" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { inlinehint 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 #4 = { mustprogress nofree nosync nounwind willreturn memory(none) 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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { nounwind willreturn memory(none) }
attributes #7 = { 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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"bool", !6, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"double", !6, i64 0}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,MemCpyOptPass,SROAPass,TailCallElimPass