; LLVM IR from erayzesen/QuarkPhysics :: QuarkPhysics/qsoftbody.ll (ZN9QSoftBodyC2Ev)

; 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.QSoftBody = type { %class.QBody.base, float, float, float, float, float, float, i8, float, i8, i8, i8, float, i8, float, i8, i8, %struct.QVector, float }
%class.QBody.base = type <{ ptr, float, float, ptr, %struct.QVector, %struct.QVector, float, float, %class.QAABB, i32, i8, i8, i8, i8, float, i32, i8, [3 x i8], float, i8, i8, [2 x i8], %struct.QVector, float, float, float, float, float, i32, i32, i8, i8, i8, i8, i32, i32, i32, i8, [3 x i8], %"class.std::function", %"class.std::function", %"class.std::function.30", i8, [7 x i8], %"class.std::vector.33", i32, i8 }>
%class.QAABB = type { %struct.QVector, %struct.QVector, %struct.QVector, float }
%"class.std::function" = type { %"class.std::_Function_base", ptr }
%"class.std::_Function_base" = type { %"union.std::_Any_data", ptr }
%"union.std::_Any_data" = type { %"union.std::_Nocopy_types" }
%"union.std::_Nocopy_types" = type { { i64, i64 } }
%"class.std::function.30" = type { %"class.std::_Function_base", ptr }
%"class.std::vector.33" = type { %"struct.std::_Vector_base.34" }
%"struct.std::_Vector_base.34" = type { %"struct.std::_Vector_base<QMesh *, std::allocator<QMesh *>>::_Vector_impl" }
%"struct.std::_Vector_base<QMesh *, std::allocator<QMesh *>>::_Vector_impl" = type { %"struct.std::_Vector_base<QMesh *, std::allocator<QMesh *>>::_Vector_impl_data" }
%"struct.std::_Vector_base<QMesh *, std::allocator<QMesh *>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%struct.QVector = type { float, float }
%class.QBody = type <{ ptr, float, float, ptr, %struct.QVector, %struct.QVector, float, float, %class.QAABB, i32, i8, i8, i8, i8, float, i32, i8, [3 x i8], float, i8, i8, [2 x i8], %struct.QVector, float, float, float, float, float, i32, i32, i8, i8, i8, i8, i32, i32, i32, i8, [3 x i8], %"class.std::function", %"class.std::function", %"class.std::function.30", i8, [7 x i8], %"class.std::vector.33", i32, i8, [3 x i8] }>

@_ZTV9QSoftBody = external dso_local unnamed_addr constant { [12 x ptr] }, align 8

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN9QSoftBodyC2Ev(ptr noundef nonnull align 8 dereferenceable(360) %0) unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  %5 = load ptr, ptr %2, align 8
  call void @_ZN5QBodyC2Ev(ptr noundef nonnull align 8 dereferenceable(293) %5)
  store ptr getelementptr inbounds inrange(-16, 80) ({ [12 x ptr] }, ptr @_ZTV9QSoftBody, i32 0, i32 0, i32 2), ptr %5, align 8, !tbaa !9
  %6 = getelementptr inbounds %class.QSoftBody, ptr %5, i32 0, i32 1
  store float 1.000000e+00, ptr %6, align 8, !tbaa !11
  %7 = getelementptr inbounds %class.QSoftBody, ptr %5, i32 0, i32 2
  store float 0.000000e+00, ptr %7, align 4, !tbaa !29
  %8 = getelementptr inbounds %class.QSoftBody, ptr %5, i32 0, i32 3
  store float 0x3FE99999A0000000, ptr %8, align 8, !tbaa !30
  %9 = getelementptr inbounds %class.QSoftBody, ptr %5, i32 0, i32 4
  store float 1.000000e+00, ptr %9, align 4, !tbaa !31
  %10 = getelementptr inbounds %class.QSoftBody, ptr %5, i32 0, i32 5
  store float 0.000000e+00, ptr %10, align 8, !tbaa !32
  %11 = getelementptr inbounds %class.QSoftBody, ptr %5, i32 0, i32 6
  store float 1.000000e+00, ptr %11, align 4, !tbaa !33
  %12 = getelementptr inbounds %class.QSoftBody, ptr %5, i32 0, i32 7
  store i8 0, ptr %12, align 8, !tbaa !34
  %13 = getelementptr inbounds %class.QSoftBody, ptr %5, i32 0, i32 8
  store float 0.000000e+00, ptr %13, align 4, !tbaa !35
  %14 = getelementptr inbounds %class.QSoftBody, ptr %5, i32 0, i32 9
  store i8 0, ptr %14, align 8, !tbaa !36
  %15 = getelementptr inbounds %class.QSoftBody, ptr %5, i32 0, i32 10
  store i8 0, ptr %15, align 1, !tbaa !37
  %16 = getelementptr inbounds %class.QSoftBody, ptr %5, i32 0, i32 11
  store i8 0, ptr %16, align 2, !tbaa !38
  %17 = getelementptr inbounds %class.QSoftBody, ptr %5, i32 0, i32 12
  store float 0.000000e+00, ptr %17, align 4, !tbaa !39
  %18 = getelementptr inbounds %class.QSoftBody, ptr %5, i32 0, i32 13
  store i8 0, ptr %18, align 8, !tbaa !40
  %19 = getelementptr inbounds %class.QSoftBody, ptr %5, i32 0, i32 14
  store float 0x3FD99999A0000000, ptr %19, align 4, !tbaa !41
  %20 = getelementptr inbounds %class.QSoftBody, ptr %5, i32 0, i32 15
  store i8 0, ptr %20, align 8, !tbaa !42
  %21 = getelementptr inbounds %class.QSoftBody, ptr %5, i32 0, i32 16
  store i8 0, ptr %21, align 1, !tbaa !43
  %22 = getelementptr inbounds %class.QSoftBody, ptr %5, i32 0, i32 17
  %23 = invoke <2 x float> @_ZN7QVector4ZeroEv()
          to label %24 unwind label %28

24:                                               ; preds = %1
  store <2 x float> %23, ptr %22, align 4
  %25 = getelementptr inbounds %class.QSoftBody, ptr %5, i32 0, i32 18
  store float 0.000000e+00, ptr %25, align 4, !tbaa !44
  %26 = getelementptr inbounds %class.QBody, ptr %5, i32 0, i32 45
  store i32 0, ptr %26, align 8, !tbaa !45
  %27 = getelementptr inbounds %class.QBody, ptr %5, i32 0, i32 15
  store i32 2, ptr %27, align 8, !tbaa !46
  ret void

28:                                               ; preds = %1
  %29 = landingpad { ptr, i32 }
          cleanup
  %30 = extractvalue { ptr, i32 } %29, 0
  store ptr %30, ptr %3, align 8
  %31 = extractvalue { ptr, i32 } %29, 1
  store i32 %31, ptr %4, align 4
  call void @_ZN5QBodyD2Ev(ptr noundef nonnull align 8 dereferenceable(293) %5) #3
  br label %32

32:                                               ; preds = %28
  %33 = load ptr, ptr %3, align 8
  %34 = load i32, ptr %4, align 4
  %35 = insertvalue { ptr, i32 } poison, ptr %33, 0
  %36 = insertvalue { ptr, i32 } %35, i32 %34, 1
  resume { ptr, i32 } %36
}

declare void @_ZN5QBodyC2Ev(ptr noundef nonnull align 8 dereferenceable(293)) unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare dso_local <2 x float> @_ZN7QVector4ZeroEv() #0 align 2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: nounwind
declare void @_ZN5QBodyD2Ev(ptr noundef nonnull align 8 dereferenceable(293)) unnamed_addr #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 = { "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 = { nounwind "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 = { 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, !10, i64 0}
!10 = !{!"vtable pointer", !8, i64 0}
!11 = !{!12, !14, i64 296}
!12 = !{!"_ZTS9QSoftBody", !13, i64 0, !14, i64 296, !14, i64 300, !14, i64 304, !14, i64 308, !14, i64 312, !14, i64 316, !18, i64 320, !14, i64 324, !18, i64 328, !18, i64 329, !18, i64 330, !14, i64 332, !18, i64 336, !14, i64 340, !18, i64 344, !18, i64 345, !15, i64 348, !14, i64 356}
!13 = !{!"_ZTS5QBody", !14, i64 8, !14, i64 12, !6, i64 16, !15, i64 24, !15, i64 32, !14, i64 40, !14, i64 44, !16, i64 48, !17, i64 76, !18, i64 80, !18, i64 81, !18, i64 82, !14, i64 84, !19, i64 88, !18, i64 92, !14, i64 96, !18, i64 100, !18, i64 101, !15, i64 104, !14, i64 112, !14, i64 116, !14, i64 120, !14, i64 124, !14, i64 128, !20, i64 132, !20, i64 136, !18, i64 140, !18, i64 141, !18, i64 142, !20, i64 144, !20, i64 148, !20, i64 152, !18, i64 156, !21, i64 160, !21, i64 192, !23, i64 224, !18, i64 256, !24, i64 264, !28, i64 288, !18, i64 292}
!14 = !{!"float", !7, i64 0}
!15 = !{!"_ZTS7QVector", !14, i64 0, !14, i64 4}
!16 = !{!"_ZTS5QAABB", !15, i64 0, !15, i64 8, !15, i64 16, !14, i64 24}
!17 = !{!"_ZTSN5QBody5ModesE", !7, i64 0}
!18 = !{!"bool", !7, i64 0}
!19 = !{!"_ZTSN5QBody9BodyTypesE", !7, i64 0}
!20 = !{!"int", !7, i64 0}
!21 = !{!"_ZTSSt8functionIFvP5QBodyEE", !22, i64 0, !6, i64 24}
!22 = !{!"_ZTSSt14_Function_base", !7, i64 0, !6, i64 16}
!23 = !{!"_ZTSSt8functionIFbP5QBodyNS0_13CollisionInfoEEE", !22, i64 0, !6, i64 24}
!24 = !{!"_ZTSSt6vectorIP5QMeshSaIS1_EE", !25, i64 0}
!25 = !{!"_ZTSSt12_Vector_baseIP5QMeshSaIS1_EE", !26, i64 0}
!26 = !{!"_ZTSNSt12_Vector_baseIP5QMeshSaIS1_EE12_Vector_implE", !27, i64 0}
!27 = !{!"_ZTSNSt12_Vector_baseIP5QMeshSaIS1_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!28 = !{!"_ZTSN5QBody16SimulationModelsE", !7, i64 0}
!29 = !{!12, !14, i64 300}
!30 = !{!12, !14, i64 304}
!31 = !{!12, !14, i64 308}
!32 = !{!12, !14, i64 312}
!33 = !{!12, !14, i64 316}
!34 = !{!12, !18, i64 320}
!35 = !{!12, !14, i64 324}
!36 = !{!12, !18, i64 328}
!37 = !{!12, !18, i64 329}
!38 = !{!12, !18, i64 330}
!39 = !{!12, !14, i64 332}
!40 = !{!12, !18, i64 336}
!41 = !{!12, !14, i64 340}
!42 = !{!12, !18, i64 344}
!43 = !{!12, !18, i64 345}
!44 = !{!12, !14, i64 356}
!45 = !{!13, !28, i64 288}
!46 = !{!13, !19, i64 88}


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

@_ZTV9QSoftBody = external dso_local unnamed_addr constant { [12 x ptr] }, align 8

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN9QSoftBodyC2Ev(ptr noundef nonnull align 8 dereferenceable(360) %0) unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  tail call void @_ZN5QBodyC2Ev(ptr noundef nonnull align 8 dereferenceable(293) %0)
  store ptr getelementptr inbounds inrange(-16, 80) (i8, ptr @_ZTV9QSoftBody, i64 16), ptr %0, align 8, !tbaa !5
  %2 = getelementptr inbounds i8, ptr %0, i64 296
  store <4 x float> <float 1.000000e+00, float 0.000000e+00, float 0x3FE99999A0000000, float 1.000000e+00>, ptr %2, align 8, !tbaa !8
  %3 = getelementptr inbounds i8, ptr %0, i64 312
  store <2 x float> <float 0.000000e+00, float 1.000000e+00>, ptr %3, align 8, !tbaa !8
  %4 = getelementptr inbounds i8, ptr %0, i64 320
  store i8 0, ptr %4, align 8, !tbaa !11
  %5 = getelementptr inbounds i8, ptr %0, i64 324
  %6 = getelementptr inbounds i8, ptr %0, i64 332
  store float 0.000000e+00, ptr %6, align 4, !tbaa !29
  %7 = getelementptr inbounds i8, ptr %0, i64 336
  store i8 0, ptr %7, align 8, !tbaa !30
  %8 = getelementptr inbounds i8, ptr %0, i64 340
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(7) %5, i8 0, i64 7, i1 false)
  store float 0x3FD99999A0000000, ptr %8, align 4, !tbaa !31
  %9 = getelementptr inbounds i8, ptr %0, i64 344
  store i8 0, ptr %9, align 8, !tbaa !32
  %10 = getelementptr inbounds i8, ptr %0, i64 345
  store i8 0, ptr %10, align 1, !tbaa !33
  %11 = invoke <2 x float> @_ZN7QVector4ZeroEv()
          to label %12 unwind label %17

12:                                               ; preds = %1
  %13 = getelementptr inbounds i8, ptr %0, i64 348
  store <2 x float> %11, ptr %13, align 4
  %14 = getelementptr inbounds i8, ptr %0, i64 356
  store float 0.000000e+00, ptr %14, align 4, !tbaa !34
  %15 = getelementptr inbounds i8, ptr %0, i64 288
  store i32 0, ptr %15, align 8, !tbaa !35
  %16 = getelementptr inbounds i8, ptr %0, i64 88
  store i32 2, ptr %16, align 8, !tbaa !36
  ret void

17:                                               ; preds = %1
  %18 = landingpad { ptr, i32 }
          cleanup
  tail call void @_ZN5QBodyD2Ev(ptr noundef nonnull align 8 dereferenceable(293) %0) #4
  resume { ptr, i32 } %18
}

declare void @_ZN5QBodyC2Ev(ptr noundef nonnull align 8 dereferenceable(293)) unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare dso_local <2 x float> @_ZN7QVector4ZeroEv() local_unnamed_addr #0 align 2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: nounwind
declare void @_ZN5QBodyD2Ev(ptr noundef nonnull align 8 dereferenceable(293)) unnamed_addr #2

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

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 = { "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 = { nounwind "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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { 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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"float", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = !{!12, !18, i64 320}
!12 = !{!"_ZTS9QSoftBody", !13, i64 0, !9, i64 296, !9, i64 300, !9, i64 304, !9, i64 308, !9, i64 312, !9, i64 316, !18, i64 320, !9, i64 324, !18, i64 328, !18, i64 329, !18, i64 330, !9, i64 332, !18, i64 336, !9, i64 340, !18, i64 344, !18, i64 345, !15, i64 348, !9, i64 356}
!13 = !{!"_ZTS5QBody", !9, i64 8, !9, i64 12, !14, i64 16, !15, i64 24, !15, i64 32, !9, i64 40, !9, i64 44, !16, i64 48, !17, i64 76, !18, i64 80, !18, i64 81, !18, i64 82, !9, i64 84, !19, i64 88, !18, i64 92, !9, i64 96, !18, i64 100, !18, i64 101, !15, i64 104, !9, i64 112, !9, i64 116, !9, i64 120, !9, i64 124, !9, i64 128, !20, i64 132, !20, i64 136, !18, i64 140, !18, i64 141, !18, i64 142, !20, i64 144, !20, i64 148, !20, i64 152, !18, i64 156, !21, i64 160, !21, i64 192, !23, i64 224, !18, i64 256, !24, i64 264, !28, i64 288, !18, i64 292}
!14 = !{!"any pointer", !10, i64 0}
!15 = !{!"_ZTS7QVector", !9, i64 0, !9, i64 4}
!16 = !{!"_ZTS5QAABB", !15, i64 0, !15, i64 8, !15, i64 16, !9, i64 24}
!17 = !{!"_ZTSN5QBody5ModesE", !10, i64 0}
!18 = !{!"bool", !10, i64 0}
!19 = !{!"_ZTSN5QBody9BodyTypesE", !10, i64 0}
!20 = !{!"int", !10, i64 0}
!21 = !{!"_ZTSSt8functionIFvP5QBodyEE", !22, i64 0, !14, i64 24}
!22 = !{!"_ZTSSt14_Function_base", !10, i64 0, !14, i64 16}
!23 = !{!"_ZTSSt8functionIFbP5QBodyNS0_13CollisionInfoEEE", !22, i64 0, !14, i64 24}
!24 = !{!"_ZTSSt6vectorIP5QMeshSaIS1_EE", !25, i64 0}
!25 = !{!"_ZTSSt12_Vector_baseIP5QMeshSaIS1_EE", !26, i64 0}
!26 = !{!"_ZTSNSt12_Vector_baseIP5QMeshSaIS1_EE12_Vector_implE", !27, i64 0}
!27 = !{!"_ZTSNSt12_Vector_baseIP5QMeshSaIS1_EE17_Vector_impl_dataE", !14, i64 0, !14, i64 8, !14, i64 16}
!28 = !{!"_ZTSN5QBody16SimulationModelsE", !10, i64 0}
!29 = !{!12, !9, i64 332}
!30 = !{!12, !18, i64 336}
!31 = !{!12, !9, i64 340}
!32 = !{!12, !18, i64 344}
!33 = !{!12, !18, i64 345}
!34 = !{!12, !9, i64 356}
!35 = !{!13, !28, i64 288}
!36 = !{!13, !19, i64 88}


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