; LLVM IR from jrouwe/JoltPhysics :: Jolt/Physics/Vehicle/VehicleEngine.ll (ZN3JPH21VehicleEngineSettingsC2Ev)

; 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.JPH::VehicleEngineSettings" = type { float, float, float, %"class.JPH::LinearCurve", float, float }
%"class.JPH::LinearCurve" = type { %"class.JPH::Array" }
%"class.JPH::Array" = type { i64, i64, ptr }

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3JPH21VehicleEngineSettingsC2Ev(ptr noundef nonnull align 8 dereferenceable(48) %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
  %6 = getelementptr inbounds %"class.JPH::VehicleEngineSettings", ptr %5, i32 0, i32 0
  store float 5.000000e+02, ptr %6, align 8, !tbaa !9
  %7 = getelementptr inbounds %"class.JPH::VehicleEngineSettings", ptr %5, i32 0, i32 1
  store float 1.000000e+03, ptr %7, align 4, !tbaa !15
  %8 = getelementptr inbounds %"class.JPH::VehicleEngineSettings", ptr %5, i32 0, i32 2
  store float 6.000000e+03, ptr %8, align 8, !tbaa !16
  %9 = getelementptr inbounds %"class.JPH::VehicleEngineSettings", ptr %5, i32 0, i32 3
  call void @_ZN3JPH11LinearCurveC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %9) #2
  %10 = getelementptr inbounds %"class.JPH::VehicleEngineSettings", ptr %5, i32 0, i32 4
  store float 5.000000e-01, ptr %10, align 8, !tbaa !17
  %11 = getelementptr inbounds %"class.JPH::VehicleEngineSettings", ptr %5, i32 0, i32 5
  store float 0x3FC99999A0000000, ptr %11, align 4, !tbaa !18
  %12 = getelementptr inbounds %"class.JPH::VehicleEngineSettings", ptr %5, i32 0, i32 3
  invoke void @_ZN3JPH11LinearCurve7ReserveEj(ptr noundef nonnull align 8 dereferenceable(24) %12, i32 noundef 3)
          to label %13 unwind label %20

13:                                               ; preds = %1
  %14 = getelementptr inbounds %"class.JPH::VehicleEngineSettings", ptr %5, i32 0, i32 3
  invoke void @_ZN3JPH11LinearCurve8AddPointEff(ptr noundef nonnull align 8 dereferenceable(24) %14, float noundef 0.000000e+00, float noundef 0x3FE99999A0000000)
          to label %15 unwind label %20

15:                                               ; preds = %13
  %16 = getelementptr inbounds %"class.JPH::VehicleEngineSettings", ptr %5, i32 0, i32 3
  invoke void @_ZN3JPH11LinearCurve8AddPointEff(ptr noundef nonnull align 8 dereferenceable(24) %16, float noundef 0x3FE51EB860000000, float noundef 1.000000e+00)
          to label %17 unwind label %20

17:                                               ; preds = %15
  %18 = getelementptr inbounds %"class.JPH::VehicleEngineSettings", ptr %5, i32 0, i32 3
  invoke void @_ZN3JPH11LinearCurve8AddPointEff(ptr noundef nonnull align 8 dereferenceable(24) %18, float noundef 1.000000e+00, float noundef 0x3FE99999A0000000)
          to label %19 unwind label %20

19:                                               ; preds = %17
  ret void

20:                                               ; preds = %17, %15, %13, %1
  %21 = landingpad { ptr, i32 }
          cleanup
  %22 = extractvalue { ptr, i32 } %21, 0
  store ptr %22, ptr %3, align 8
  %23 = extractvalue { ptr, i32 } %21, 1
  store i32 %23, ptr %4, align 4
  call void @_ZN3JPH11LinearCurveD2Ev(ptr noundef nonnull align 8 dereferenceable(24) %9) #2
  br label %24

24:                                               ; preds = %20
  %25 = load ptr, ptr %3, align 8
  %26 = load i32, ptr %4, align 4
  %27 = insertvalue { ptr, i32 } poison, ptr %25, 0
  %28 = insertvalue { ptr, i32 } %27, i32 %26, 1
  resume { ptr, i32 } %28
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN3JPH11LinearCurveC2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3JPH11LinearCurve7ReserveEj(ptr noundef nonnull align 8 dereferenceable(24), i32 noundef) #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3JPH11LinearCurve8AddPointEff(ptr noundef nonnull align 8 dereferenceable(24), float noundef, float noundef) #0 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN3JPH11LinearCurveD2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #1 align 2

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 = { inlinehint 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 #2 = { 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 = !{!"_ZTSN3JPH21VehicleEngineSettingsE", !11, i64 0, !11, i64 4, !11, i64 8, !12, i64 16, !11, i64 40, !11, i64 44}
!11 = !{!"float", !7, i64 0}
!12 = !{!"_ZTSN3JPH11LinearCurveE", !13, i64 0}
!13 = !{!"_ZTSN3JPH5ArrayINS_11LinearCurve5PointENS_12STLAllocatorIS2_EEEE", !14, i64 0, !14, i64 8, !6, i64 16}
!14 = !{!"long", !7, i64 0}
!15 = !{!10, !11, i64 4}
!16 = !{!10, !11, i64 8}
!17 = !{!10, !11, i64 40}
!18 = !{!10, !11, i64 44}


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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3JPH21VehicleEngineSettingsC2Ev(ptr noundef nonnull align 8 dereferenceable(48) %0) unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  store <2 x float> <float 5.000000e+02, float 1.000000e+03>, ptr %0, align 8, !tbaa !5
  %2 = getelementptr inbounds i8, ptr %0, i64 8
  store float 6.000000e+03, ptr %2, align 8, !tbaa !9
  %3 = getelementptr inbounds i8, ptr %0, i64 16
  tail call void @_ZN3JPH11LinearCurveC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %3) #2
  %4 = getelementptr inbounds i8, ptr %0, i64 40
  store <2 x float> <float 5.000000e-01, float 0x3FC99999A0000000>, ptr %4, align 8, !tbaa !5
  invoke void @_ZN3JPH11LinearCurve7ReserveEj(ptr noundef nonnull align 8 dereferenceable(24) %3, i32 noundef 3)
          to label %5 unwind label %9

5:                                                ; preds = %1
  invoke void @_ZN3JPH11LinearCurve8AddPointEff(ptr noundef nonnull align 8 dereferenceable(24) %3, float noundef 0.000000e+00, float noundef 0x3FE99999A0000000)
          to label %6 unwind label %9

6:                                                ; preds = %5
  invoke void @_ZN3JPH11LinearCurve8AddPointEff(ptr noundef nonnull align 8 dereferenceable(24) %3, float noundef 0x3FE51EB860000000, float noundef 1.000000e+00)
          to label %7 unwind label %9

7:                                                ; preds = %6
  invoke void @_ZN3JPH11LinearCurve8AddPointEff(ptr noundef nonnull align 8 dereferenceable(24) %3, float noundef 1.000000e+00, float noundef 0x3FE99999A0000000)
          to label %8 unwind label %9

8:                                                ; preds = %7
  ret void

9:                                                ; preds = %7, %6, %5, %1
  %10 = landingpad { ptr, i32 }
          cleanup
  tail call void @_ZN3JPH11LinearCurveD2Ev(ptr noundef nonnull align 8 dereferenceable(24) %3) #2
  resume { ptr, i32 } %10
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN3JPH11LinearCurveC2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3JPH11LinearCurve7ReserveEj(ptr noundef nonnull align 8 dereferenceable(24), i32 noundef) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3JPH11LinearCurve8AddPointEff(ptr noundef nonnull align 8 dereferenceable(24), float noundef, float noundef) local_unnamed_addr #0 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN3JPH11LinearCurveD2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #1 align 2

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 = { inlinehint 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 #2 = { 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 = !{!"float", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !6, i64 8}
!10 = !{!"_ZTSN3JPH21VehicleEngineSettingsE", !6, i64 0, !6, i64 4, !6, i64 8, !11, i64 16, !6, i64 40, !6, i64 44}
!11 = !{!"_ZTSN3JPH11LinearCurveE", !12, i64 0}
!12 = !{!"_ZTSN3JPH5ArrayINS_11LinearCurve5PointENS_12STLAllocatorIS2_EEEE", !13, i64 0, !13, i64 8, !14, i64 16}
!13 = !{!"long", !7, i64 0}
!14 = !{!"any pointer", !7, i64 0}


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