; LLVM IR from jrouwe/JoltPhysics :: Jolt/Core/LinearCurve.ll (ZN3JPH13GetRTTIOfTypeEPNS_11LinearCurve5PointE)

; 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::RTTI" = type { ptr, i32, [4 x i8], %"class.JPH::StaticArray", ptr, ptr }
%"class.JPH::StaticArray" = type { i32, [4 x i8], [4 x %"struct.JPH::StaticArray<JPH::RTTI::BaseClass, 4>::Storage"] }
%"struct.JPH::StaticArray<JPH::RTTI::BaseClass, 4>::Storage" = type { [16 x i8] }
%class.anon = type { i8 }
%class.anon.0 = type { i8 }

@_ZZN3JPH13GetRTTIOfTypeEPNS_11LinearCurve5PointEE4rtti = external hidden global %"class.JPH::RTTI", align 8
@_ZGVZN3JPH13GetRTTIOfTypeEPNS_11LinearCurve5PointEE4rtti = external hidden global i64, align 8
@.str = external hidden unnamed_addr constant [19 x i8], align 1
@__dso_handle = external hidden global i8

; Function Attrs: nounwind
declare i32 @__cxa_guard_acquire(ptr) #0

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

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: nounwind
declare void @__cxa_guard_abort(ptr) #0

; Function Attrs: nounwind
declare void @__cxa_guard_release(ptr) #0

; Function Attrs: mustprogress uwtable
define dso_local noundef ptr @_ZN3JPH13GetRTTIOfTypeEPNS_11LinearCurve5PointE(ptr noundef %0) #2 personality ptr @__gxx_personality_v0 {
  %2 = alloca ptr, align 8
  %3 = alloca %class.anon, align 1
  %4 = alloca %class.anon.0, align 1
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  %7 = load atomic i8, ptr @_ZGVZN3JPH13GetRTTIOfTypeEPNS_11LinearCurve5PointEE4rtti acquire, align 8
  %8 = icmp eq i8 %7, 0
  br i1 %8, label %9, label %17, !prof !9

9:                                                ; preds = %1
  %10 = call i32 @__cxa_guard_acquire(ptr @_ZGVZN3JPH13GetRTTIOfTypeEPNS_11LinearCurve5PointEE4rtti) #0
  %11 = icmp ne i32 %10, 0
  br i1 %11, label %12, label %17

12:                                               ; preds = %9
  call void @llvm.lifetime.start.p0(i64 1, ptr %3) #0
  %13 = call noundef ptr @"_ZZN3JPH13GetRTTIOfTypeEPNS_11LinearCurve5PointEENK3$_0cvPFPvvEEv"(ptr noundef nonnull align 1 dereferenceable(1) %3) #0
  call void @llvm.lifetime.start.p0(i64 1, ptr %4) #0
  %14 = call noundef ptr @"_ZZN3JPH13GetRTTIOfTypeEPNS_11LinearCurve5PointEENK3$_1cvPFvPvEEv"(ptr noundef nonnull align 1 dereferenceable(1) %4) #0
  invoke void @_ZN3JPH4RTTIC1EPKciPFPvvEPFvS3_EPFvRS0_E(ptr noundef nonnull align 8 dereferenceable(104) @_ZZN3JPH13GetRTTIOfTypeEPNS_11LinearCurve5PointEE4rtti, ptr noundef @.str, i32 noundef 8, ptr noundef %13, ptr noundef %14, ptr noundef @_ZN3JPH11LinearCurve5Point11sCreateRTTIERNS_4RTTIE)
          to label %15 unwind label %18

15:                                               ; preds = %12
  call void @llvm.lifetime.end.p0(i64 1, ptr %4) #0
  call void @llvm.lifetime.end.p0(i64 1, ptr %3) #0
  %16 = call i32 @__cxa_atexit(ptr @_ZN3JPH4RTTID2Ev, ptr @_ZZN3JPH13GetRTTIOfTypeEPNS_11LinearCurve5PointEE4rtti, ptr @__dso_handle) #0
  call void @__cxa_guard_release(ptr @_ZGVZN3JPH13GetRTTIOfTypeEPNS_11LinearCurve5PointEE4rtti) #0
  br label %17

17:                                               ; preds = %15, %9, %1
  ret ptr @_ZZN3JPH13GetRTTIOfTypeEPNS_11LinearCurve5PointEE4rtti

18:                                               ; preds = %12
  %19 = landingpad { ptr, i32 }
          cleanup
  %20 = extractvalue { ptr, i32 } %19, 0
  store ptr %20, ptr %5, align 8
  %21 = extractvalue { ptr, i32 } %19, 1
  store i32 %21, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 1, ptr %4) #0
  call void @llvm.lifetime.end.p0(i64 1, ptr %3) #0
  call void @__cxa_guard_abort(ptr @_ZGVZN3JPH13GetRTTIOfTypeEPNS_11LinearCurve5PointEE4rtti) #0
  br label %22

22:                                               ; preds = %18
  %23 = load ptr, ptr %5, align 8
  %24 = load i32, ptr %6, align 4
  %25 = insertvalue { ptr, i32 } poison, ptr %23, 0
  %26 = insertvalue { ptr, i32 } %25, i32 %24, 1
  resume { ptr, i32 } %26
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden noundef ptr @"_ZZN3JPH13GetRTTIOfTypeEPNS_11LinearCurve5PointEENK3$_0cvPFPvvEEv"(ptr noundef nonnull align 1 dereferenceable(1)) #3 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden noundef ptr @"_ZZN3JPH13GetRTTIOfTypeEPNS_11LinearCurve5PointEENK3$_1cvPFvPvEEv"(ptr noundef nonnull align 1 dereferenceable(1)) #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3JPH11LinearCurve5Point11sCreateRTTIERNS_4RTTIE(ptr noundef nonnull align 8 dereferenceable(104)) #4 align 2

declare void @_ZN3JPH4RTTIC1EPKciPFPvvEPFvS3_EPFvRS0_E(ptr noundef nonnull align 8 dereferenceable(104), ptr noundef, i32 noundef, ptr noundef, ptr noundef, ptr noundef) unnamed_addr #5

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN3JPH4RTTID2Ev(ptr noundef nonnull align 8 dereferenceable(104)) unnamed_addr #3 align 2

; Function Attrs: nounwind
declare i32 @__cxa_atexit(ptr, ptr, ptr) #0

attributes #0 = { nounwind }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { 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 #4 = { 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 #5 = { "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" }

!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 = !{!"branch_weights", i32 1, i32 1048575}


; 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.JPH::RTTI" = type { ptr, i32, [4 x i8], %"class.JPH::StaticArray", ptr, ptr }
%"class.JPH::StaticArray" = type { i32, [4 x i8], [4 x %"struct.JPH::StaticArray<JPH::RTTI::BaseClass, 4>::Storage"] }
%"struct.JPH::StaticArray<JPH::RTTI::BaseClass, 4>::Storage" = type { [16 x i8] }
%class.anon = type { i8 }
%class.anon.0 = type { i8 }

@_ZZN3JPH13GetRTTIOfTypeEPNS_11LinearCurve5PointEE4rtti = external hidden global %"class.JPH::RTTI", align 8
@_ZGVZN3JPH13GetRTTIOfTypeEPNS_11LinearCurve5PointEE4rtti = external hidden global i64, align 8
@.str = external hidden unnamed_addr constant [19 x i8], align 1
@__dso_handle = external hidden global i8

; Function Attrs: nofree nounwind
declare i32 @__cxa_guard_acquire(ptr) local_unnamed_addr #0

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

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: nofree nounwind
declare void @__cxa_guard_abort(ptr) local_unnamed_addr #0

; Function Attrs: nofree nounwind
declare void @__cxa_guard_release(ptr) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
define dso_local noundef nonnull ptr @_ZN3JPH13GetRTTIOfTypeEPNS_11LinearCurve5PointE(ptr nocapture noundef readnone %0) local_unnamed_addr #2 personality ptr @__gxx_personality_v0 {
  %2 = alloca %class.anon, align 1
  %3 = alloca %class.anon.0, align 1
  %4 = load atomic i8, ptr @_ZGVZN3JPH13GetRTTIOfTypeEPNS_11LinearCurve5PointEE4rtti acquire, align 8
  %5 = icmp eq i8 %4, 0
  br i1 %5, label %6, label %13, !prof !5

6:                                                ; preds = %1
  %7 = tail call i32 @__cxa_guard_acquire(ptr nonnull @_ZGVZN3JPH13GetRTTIOfTypeEPNS_11LinearCurve5PointEE4rtti) #6
  %.not = icmp eq i32 %7, 0
  br i1 %.not, label %13, label %8

8:                                                ; preds = %6
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %2) #6
  %9 = call noundef ptr @"_ZZN3JPH13GetRTTIOfTypeEPNS_11LinearCurve5PointEENK3$_0cvPFPvvEEv"(ptr noundef nonnull align 1 dereferenceable(1) %2) #6
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %3) #6
  %10 = call noundef ptr @"_ZZN3JPH13GetRTTIOfTypeEPNS_11LinearCurve5PointEENK3$_1cvPFvPvEEv"(ptr noundef nonnull align 1 dereferenceable(1) %3) #6
  invoke void @_ZN3JPH4RTTIC1EPKciPFPvvEPFvS3_EPFvRS0_E(ptr noundef nonnull align 8 dereferenceable(104) @_ZZN3JPH13GetRTTIOfTypeEPNS_11LinearCurve5PointEE4rtti, ptr noundef nonnull @.str, i32 noundef 8, ptr noundef %9, ptr noundef %10, ptr noundef nonnull @_ZN3JPH11LinearCurve5Point11sCreateRTTIERNS_4RTTIE)
          to label %11 unwind label %14

11:                                               ; preds = %8
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %3) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %2) #6
  %12 = call i32 @__cxa_atexit(ptr nonnull @_ZN3JPH4RTTID2Ev, ptr nonnull @_ZZN3JPH13GetRTTIOfTypeEPNS_11LinearCurve5PointEE4rtti, ptr nonnull @__dso_handle) #6
  call void @__cxa_guard_release(ptr nonnull @_ZGVZN3JPH13GetRTTIOfTypeEPNS_11LinearCurve5PointEE4rtti) #6
  br label %13

13:                                               ; preds = %11, %6, %1
  ret ptr @_ZZN3JPH13GetRTTIOfTypeEPNS_11LinearCurve5PointEE4rtti

14:                                               ; preds = %8
  %15 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %3) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %2) #6
  call void @__cxa_guard_abort(ptr nonnull @_ZGVZN3JPH13GetRTTIOfTypeEPNS_11LinearCurve5PointEE4rtti) #6
  resume { ptr, i32 } %15
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden noundef ptr @"_ZZN3JPH13GetRTTIOfTypeEPNS_11LinearCurve5PointEENK3$_0cvPFPvvEEv"(ptr noundef nonnull align 1 dereferenceable(1)) local_unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden noundef ptr @"_ZZN3JPH13GetRTTIOfTypeEPNS_11LinearCurve5PointEENK3$_1cvPFvPvEEv"(ptr noundef nonnull align 1 dereferenceable(1)) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3JPH11LinearCurve5Point11sCreateRTTIERNS_4RTTIE(ptr noundef nonnull align 8 dereferenceable(104)) #4 align 2

declare void @_ZN3JPH4RTTIC1EPKciPFPvvEPFvS3_EPFvRS0_E(ptr noundef nonnull align 8 dereferenceable(104), ptr noundef, i32 noundef, ptr noundef, ptr noundef, ptr noundef) unnamed_addr #5

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN3JPH4RTTID2Ev(ptr noundef nonnull align 8 dereferenceable(104)) unnamed_addr #3 align 2

; Function Attrs: nofree nounwind
declare i32 @__cxa_atexit(ptr, ptr, ptr) local_unnamed_addr #0

attributes #0 = { nofree nounwind }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { 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 #4 = { 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 #5 = { "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 }

!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 = !{!"branch_weights", i32 1, i32 1048575}


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