; LLVM IR from jianboqi/CSF :: src/Particle.ll (ZN8Particle8timeStepEv)

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

%class.Vec3 = type { [3 x double] }
%class.Particle = type { i8, double, %class.Vec3, %class.Vec3, double, %class.Vec3, %class.Vec3, i8, i32, i32, i32, i32, %"class.std::vector", %"class.std::vector.0", i64, double, double }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<Particle *, std::allocator<Particle *>>::_Vector_impl" }
%"struct.std::_Vector_base<Particle *, std::allocator<Particle *>>::_Vector_impl" = type { %"struct.std::_Vector_base<Particle *, std::allocator<Particle *>>::_Vector_impl_data" }
%"struct.std::_Vector_base<Particle *, std::allocator<Particle *>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.0" = type { %"struct.std::_Vector_base.1" }
%"struct.std::_Vector_base.1" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" = type { ptr, ptr, ptr }

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN8Particle8timeStepEv(ptr noundef nonnull align 8 dereferenceable(216) %0) #0 align 2 {
  %2 = alloca ptr, align 8
  %3 = alloca %class.Vec3, align 8
  %4 = alloca %class.Vec3, align 8
  %5 = alloca %class.Vec3, align 8
  %6 = alloca %class.Vec3, align 8
  %7 = alloca %class.Vec3, align 8
  %8 = alloca double, align 8
  %9 = alloca %class.Vec3, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %10 = load ptr, ptr %2, align 8
  %11 = getelementptr inbounds %class.Particle, ptr %10, i32 0, i32 0
  %12 = load i8, ptr %11, align 8, !tbaa !9, !range !24, !noundef !25
  %13 = trunc i8 %12 to i1
  br i1 %13, label %14, label %23

14:                                               ; preds = %1
  call void @llvm.lifetime.start.p0(i64 24, ptr %3) #3
  %15 = getelementptr inbounds %class.Particle, ptr %10, i32 0, i32 5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %3, ptr align 8 %15, i64 24, i1 false), !tbaa.struct !26
  call void @llvm.lifetime.start.p0(i64 24, ptr %4) #3
  call void @llvm.lifetime.start.p0(i64 24, ptr %5) #3
  %16 = getelementptr inbounds %class.Particle, ptr %10, i32 0, i32 5
  call void @llvm.lifetime.start.p0(i64 24, ptr %6) #3
  call void @llvm.lifetime.start.p0(i64 24, ptr %7) #3
  %17 = getelementptr inbounds %class.Particle, ptr %10, i32 0, i32 5
  %18 = getelementptr inbounds %class.Particle, ptr %10, i32 0, i32 6
  call void @_ZN4Vec3miERKS_(ptr dead_on_unwind writable sret(%class.Vec3) align 8 %7, ptr noundef nonnull align 8 dereferenceable(24) %17, ptr noundef nonnull align 8 dereferenceable(24) %18)
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #3
  store double 0x3FEFAE147AE147AE, ptr %8, align 8, !tbaa !28
  call void @_ZN4Vec3mlERKd(ptr dead_on_unwind writable sret(%class.Vec3) align 8 %6, ptr noundef nonnull align 8 dereferenceable(24) %7, ptr noundef nonnull align 8 dereferenceable(8) %8)
  call void @_ZN4Vec3plERKS_(ptr dead_on_unwind writable sret(%class.Vec3) align 8 %5, ptr noundef nonnull align 8 dereferenceable(24) %16, ptr noundef nonnull align 8 dereferenceable(24) %6)
  call void @llvm.lifetime.start.p0(i64 24, ptr %9) #3
  %19 = getelementptr inbounds %class.Particle, ptr %10, i32 0, i32 2
  %20 = getelementptr inbounds %class.Particle, ptr %10, i32 0, i32 4
  call void @_ZN4Vec3mlERKd(ptr dead_on_unwind writable sret(%class.Vec3) align 8 %9, ptr noundef nonnull align 8 dereferenceable(24) %19, ptr noundef nonnull align 8 dereferenceable(8) %20)
  call void @_ZN4Vec3plERKS_(ptr dead_on_unwind writable sret(%class.Vec3) align 8 %4, ptr noundef nonnull align 8 dereferenceable(24) %5, ptr noundef nonnull align 8 dereferenceable(24) %9)
  %21 = getelementptr inbounds %class.Particle, ptr %10, i32 0, i32 5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %21, ptr align 8 %4, i64 24, i1 false), !tbaa.struct !26
  call void @llvm.lifetime.end.p0(i64 24, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 24, ptr %7) #3
  call void @llvm.lifetime.end.p0(i64 24, ptr %6) #3
  call void @llvm.lifetime.end.p0(i64 24, ptr %5) #3
  call void @llvm.lifetime.end.p0(i64 24, ptr %4) #3
  %22 = getelementptr inbounds %class.Particle, ptr %10, i32 0, i32 6
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %22, ptr align 8 %3, i64 24, i1 false), !tbaa.struct !26
  call void @llvm.lifetime.end.p0(i64 24, ptr %3) #3
  br label %23

23:                                               ; preds = %14, %1
  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: mustprogress uwtable
declare dso_local void @_ZN4Vec3plERKS_(ptr dead_on_unwind noalias writable sret(%class.Vec3) align 8, ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4Vec3miERKS_(ptr dead_on_unwind noalias writable sret(%class.Vec3) align 8, ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4Vec3mlERKd(ptr dead_on_unwind noalias writable sret(%class.Vec3) align 8, ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(8)) #0 align 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 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 = !{!"_ZTS8Particle", !11, i64 0, !12, i64 8, !13, i64 16, !13, i64 40, !12, i64 64, !13, i64 72, !13, i64 96, !11, i64 120, !14, i64 124, !14, i64 128, !14, i64 132, !14, i64 136, !15, i64 144, !19, i64 168, !23, i64 192, !12, i64 200, !12, i64 208}
!11 = !{!"bool", !7, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = !{!"_ZTS4Vec3", !7, i64 0}
!14 = !{!"int", !7, i64 0}
!15 = !{!"_ZTSSt6vectorIP8ParticleSaIS1_EE", !16, i64 0}
!16 = !{!"_ZTSSt12_Vector_baseIP8ParticleSaIS1_EE", !17, i64 0}
!17 = !{!"_ZTSNSt12_Vector_baseIP8ParticleSaIS1_EE12_Vector_implE", !18, i64 0}
!18 = !{!"_ZTSNSt12_Vector_baseIP8ParticleSaIS1_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!19 = !{!"_ZTSSt6vectorIiSaIiEE", !20, i64 0}
!20 = !{!"_ZTSSt12_Vector_baseIiSaIiEE", !21, i64 0}
!21 = !{!"_ZTSNSt12_Vector_baseIiSaIiEE12_Vector_implE", !22, i64 0}
!22 = !{!"_ZTSNSt12_Vector_baseIiSaIiEE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!23 = !{!"long", !7, i64 0}
!24 = !{i8 0, i8 2}
!25 = !{}
!26 = !{i64 0, i64 24, !27}
!27 = !{!7, !7, i64 0}
!28 = !{!12, !12, 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"

%class.Vec3 = type { [3 x double] }

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN8Particle8timeStepEv(ptr noundef nonnull align 8 dereferenceable(216) %0) local_unnamed_addr #0 align 2 {
  %.sroa.0 = alloca [3 x double], align 8
  %2 = alloca %class.Vec3, align 8
  %3 = alloca %class.Vec3, align 8
  %4 = alloca %class.Vec3, align 8
  %5 = alloca %class.Vec3, align 8
  %6 = alloca double, align 8
  %7 = alloca %class.Vec3, align 8
  %8 = load i8, ptr %0, align 8, !tbaa !5, !range !23, !noundef !24
  %9 = trunc nuw i8 %8 to i1
  br i1 %9, label %10, label %15

10:                                               ; preds = %1
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %.sroa.0)
  %11 = getelementptr inbounds i8, ptr %0, i64 72
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %.sroa.0, ptr noundef nonnull align 8 dereferenceable(24) %11, i64 24, i1 false), !tbaa.struct !25
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %2) #3
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %3) #3
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %4) #3
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %5) #3
  %12 = getelementptr inbounds i8, ptr %0, i64 96
  call void @_ZN4Vec3miERKS_(ptr dead_on_unwind nonnull writable sret(%class.Vec3) align 8 %5, ptr noundef nonnull align 8 dereferenceable(24) %11, ptr noundef nonnull align 8 dereferenceable(24) %12)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #3
  store double 0x3FEFAE147AE147AE, ptr %6, align 8, !tbaa !27
  call void @_ZN4Vec3mlERKd(ptr dead_on_unwind nonnull writable sret(%class.Vec3) align 8 %4, ptr noundef nonnull align 8 dereferenceable(24) %5, ptr noundef nonnull align 8 dereferenceable(8) %6)
  call void @_ZN4Vec3plERKS_(ptr dead_on_unwind nonnull writable sret(%class.Vec3) align 8 %3, ptr noundef nonnull align 8 dereferenceable(24) %11, ptr noundef nonnull align 8 dereferenceable(24) %4)
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %7) #3
  %13 = getelementptr inbounds i8, ptr %0, i64 16
  %14 = getelementptr inbounds i8, ptr %0, i64 64
  call void @_ZN4Vec3mlERKd(ptr dead_on_unwind nonnull writable sret(%class.Vec3) align 8 %7, ptr noundef nonnull align 8 dereferenceable(24) %13, ptr noundef nonnull align 8 dereferenceable(8) %14)
  call void @_ZN4Vec3plERKS_(ptr dead_on_unwind nonnull writable sret(%class.Vec3) align 8 %2, ptr noundef nonnull align 8 dereferenceable(24) %3, ptr noundef nonnull align 8 dereferenceable(24) %7)
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %11, ptr noundef nonnull align 8 dereferenceable(24) %2, i64 24, i1 false), !tbaa.struct !25
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %7) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #3
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %5) #3
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %4) #3
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %3) #3
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %2) #3
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %12, ptr noundef nonnull align 8 dereferenceable(24) %.sroa.0, i64 24, i1 false), !tbaa.struct !25
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %.sroa.0)
  br label %15

15:                                               ; preds = %10, %1
  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 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: mustprogress uwtable
declare dso_local void @_ZN4Vec3plERKS_(ptr dead_on_unwind noalias writable sret(%class.Vec3) align 8, ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4Vec3miERKS_(ptr dead_on_unwind noalias writable sret(%class.Vec3) align 8, ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4Vec3mlERKd(ptr dead_on_unwind noalias writable sret(%class.Vec3) align 8, ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #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 nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress 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, !7, i64 0}
!6 = !{!"_ZTS8Particle", !7, i64 0, !10, i64 8, !11, i64 16, !11, i64 40, !10, i64 64, !11, i64 72, !11, i64 96, !7, i64 120, !12, i64 124, !12, i64 128, !12, i64 132, !12, i64 136, !13, i64 144, !18, i64 168, !22, i64 192, !10, i64 200, !10, i64 208}
!7 = !{!"bool", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"double", !8, i64 0}
!11 = !{!"_ZTS4Vec3", !8, i64 0}
!12 = !{!"int", !8, i64 0}
!13 = !{!"_ZTSSt6vectorIP8ParticleSaIS1_EE", !14, i64 0}
!14 = !{!"_ZTSSt12_Vector_baseIP8ParticleSaIS1_EE", !15, i64 0}
!15 = !{!"_ZTSNSt12_Vector_baseIP8ParticleSaIS1_EE12_Vector_implE", !16, i64 0}
!16 = !{!"_ZTSNSt12_Vector_baseIP8ParticleSaIS1_EE17_Vector_impl_dataE", !17, i64 0, !17, i64 8, !17, i64 16}
!17 = !{!"any pointer", !8, i64 0}
!18 = !{!"_ZTSSt6vectorIiSaIiEE", !19, i64 0}
!19 = !{!"_ZTSSt12_Vector_baseIiSaIiEE", !20, i64 0}
!20 = !{!"_ZTSNSt12_Vector_baseIiSaIiEE12_Vector_implE", !21, i64 0}
!21 = !{!"_ZTSNSt12_Vector_baseIiSaIiEE17_Vector_impl_dataE", !17, i64 0, !17, i64 8, !17, i64 16}
!22 = !{!"long", !8, i64 0}
!23 = !{i8 0, i8 2}
!24 = !{}
!25 = !{i64 0, i64 24, !26}
!26 = !{!8, !8, i64 0}
!27 = !{!10, !10, i64 0}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,SROAPass