; LLVM IR from SOHNE/Dura2D :: src/kinetics/d2World.ll (ZN7d2WorldC2ERK6d2Vec2)

; 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.d2Vec2 = type { float, float }
%class.d2World = type { %struct.d2Vec2, ptr, %class.d2BlockAllocator, ptr, i32, ptr, i32, ptr }
%class.d2BlockAllocator = type { ptr, i32, i32, [14 x ptr] }

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN7d2WorldC2ERK6d2Vec2(ptr noundef nonnull align 8 dereferenceable(184) %0, ptr noundef nonnull align 4 dereferenceable(8) %1) unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca %struct.d2Vec2, align 4
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %8 = load ptr, ptr %3, align 8
  %9 = getelementptr inbounds %class.d2World, ptr %8, i32 0, i32 0
  call void @_ZN6d2Vec2C2Eff(ptr noundef nonnull align 4 dereferenceable(8) %9, float noundef 0.000000e+00, float noundef 0xC0239999A0000000)
  %10 = getelementptr inbounds %class.d2World, ptr %8, i32 0, i32 2
  call void @_ZN16d2BlockAllocatorC1Ev(ptr noundef nonnull align 8 dereferenceable(128) %10)
  %11 = getelementptr inbounds %class.d2World, ptr %8, i32 0, i32 3
  store ptr null, ptr %11, align 8, !tbaa !9
  %12 = getelementptr inbounds %class.d2World, ptr %8, i32 0, i32 4
  store i32 0, ptr %12, align 8, !tbaa !15
  %13 = getelementptr inbounds %class.d2World, ptr %8, i32 0, i32 5
  store ptr null, ptr %13, align 8, !tbaa !16
  %14 = getelementptr inbounds %class.d2World, ptr %8, i32 0, i32 6
  store i32 0, ptr %14, align 8, !tbaa !17
  %15 = getelementptr inbounds %class.d2World, ptr %8, i32 0, i32 7
  store ptr null, ptr %15, align 8, !tbaa !18
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #7
  %16 = load ptr, ptr %4, align 8, !tbaa !5
  %17 = invoke <2 x float> @_ZNK6d2Vec2mlEf(ptr noundef nonnull align 4 dereferenceable(8) %16, float noundef -1.000000e+00)
          to label %18 unwind label %26

18:                                               ; preds = %2
  store <2 x float> %17, ptr %5, align 4
  %19 = getelementptr inbounds %class.d2World, ptr %8, i32 0, i32 0
  %20 = invoke noundef nonnull align 4 dereferenceable(8) ptr @_ZN6d2Vec2aSERKS_(ptr noundef nonnull align 4 dereferenceable(8) %19, ptr noundef nonnull align 4 dereferenceable(8) %5)
          to label %21 unwind label %26

21:                                               ; preds = %18
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #7
  %22 = invoke noalias noundef nonnull ptr @_Znwm(i64 noundef 72) #8
          to label %23 unwind label %30

23:                                               ; preds = %21
  invoke void @_ZN10d2AABBTreeC2Ev(ptr noundef nonnull align 8 dereferenceable(72) %22)
          to label %24 unwind label %34

24:                                               ; preds = %23
  %25 = getelementptr inbounds %class.d2World, ptr %8, i32 0, i32 1
  store ptr %22, ptr %25, align 8, !tbaa !19
  ret void

26:                                               ; preds = %18, %2
  %27 = landingpad { ptr, i32 }
          cleanup
  %28 = extractvalue { ptr, i32 } %27, 0
  store ptr %28, ptr %6, align 8
  %29 = extractvalue { ptr, i32 } %27, 1
  store i32 %29, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #7
  br label %38

30:                                               ; preds = %21
  %31 = landingpad { ptr, i32 }
          cleanup
  %32 = extractvalue { ptr, i32 } %31, 0
  store ptr %32, ptr %6, align 8
  %33 = extractvalue { ptr, i32 } %31, 1
  store i32 %33, ptr %7, align 4
  br label %38

34:                                               ; preds = %23
  %35 = landingpad { ptr, i32 }
          cleanup
  %36 = extractvalue { ptr, i32 } %35, 0
  store ptr %36, ptr %6, align 8
  %37 = extractvalue { ptr, i32 } %35, 1
  store i32 %37, ptr %7, align 4
  call void @_ZdlPvm(ptr noundef %22, i64 noundef 72) #9
  br label %38

38:                                               ; preds = %34, %30, %26
  call void @_ZN16d2BlockAllocatorD1Ev(ptr noundef nonnull align 8 dereferenceable(128) %10) #7
  br label %39

39:                                               ; preds = %38
  %40 = load ptr, ptr %6, align 8
  %41 = load i32, ptr %7, align 4
  %42 = insertvalue { ptr, i32 } poison, ptr %40, 0
  %43 = insertvalue { ptr, i32 } %42, i32 %41, 1
  resume { ptr, i32 } %43
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN6d2Vec2C2Eff(ptr noundef nonnull align 4 dereferenceable(8), float noundef, float noundef) unnamed_addr #1 align 2

declare void @_ZN16d2BlockAllocatorC1Ev(ptr noundef nonnull align 8 dereferenceable(128)) unnamed_addr #2

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

declare <2 x float> @_ZNK6d2Vec2mlEf(ptr noundef nonnull align 4 dereferenceable(8), float noundef) #2

declare i32 @__gxx_personality_v0(...)

declare noundef nonnull align 4 dereferenceable(8) ptr @_ZN6d2Vec2aSERKS_(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(8)) #2

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

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znwm(i64 noundef) #4

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

; Function Attrs: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, i64 noundef) #5

; Function Attrs: nounwind
declare void @_ZN16d2BlockAllocatorD1Ev(ptr noundef nonnull align 8 dereferenceable(128)) unnamed_addr #6

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 = { 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 = { "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 nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { nobuiltin allocsize(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 = { nobuiltin 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 #6 = { 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 #7 = { nounwind }
attributes #8 = { builtin allocsize(0) }
attributes #9 = { builtin 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, !6, i64 144}
!10 = !{!"_ZTS7d2World", !11, i64 0, !6, i64 8, !13, i64 16, !6, i64 144, !14, i64 152, !6, i64 160, !14, i64 168, !6, i64 176}
!11 = !{!"_ZTS6d2Vec2", !12, i64 0, !12, i64 4}
!12 = !{!"float", !7, i64 0}
!13 = !{!"_ZTS16d2BlockAllocator", !6, i64 0, !14, i64 8, !14, i64 12, !7, i64 16}
!14 = !{!"int", !7, i64 0}
!15 = !{!10, !14, i64 152}
!16 = !{!10, !6, i64 160}
!17 = !{!10, !14, i64 168}
!18 = !{!10, !6, i64 176}
!19 = !{!10, !6, i64 8}


; 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.d2Vec2 = type { float, float }

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN7d2WorldC2ERK6d2Vec2(ptr noundef nonnull align 8 dereferenceable(184) %0, ptr noundef nonnull align 4 dereferenceable(8) %1) unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca %struct.d2Vec2, align 8
  tail call void @_ZN6d2Vec2C2Eff(ptr noundef nonnull align 4 dereferenceable(8) %0, float noundef 0.000000e+00, float noundef 0xC0239999A0000000)
  %4 = getelementptr inbounds i8, ptr %0, i64 16
  tail call void @_ZN16d2BlockAllocatorC1Ev(ptr noundef nonnull align 8 dereferenceable(128) %4)
  %5 = getelementptr inbounds i8, ptr %0, i64 144
  store ptr null, ptr %5, align 8, !tbaa !5
  %6 = getelementptr inbounds i8, ptr %0, i64 152
  store i32 0, ptr %6, align 8, !tbaa !14
  %7 = getelementptr inbounds i8, ptr %0, i64 160
  store ptr null, ptr %7, align 8, !tbaa !15
  %8 = getelementptr inbounds i8, ptr %0, i64 168
  store i32 0, ptr %8, align 8, !tbaa !16
  %9 = getelementptr inbounds i8, ptr %0, i64 176
  store ptr null, ptr %9, align 8, !tbaa !17
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #6
  %10 = invoke <2 x float> @_ZNK6d2Vec2mlEf(ptr noundef nonnull align 4 dereferenceable(8) %1, float noundef -1.000000e+00)
          to label %11 unwind label %17

11:                                               ; preds = %2
  store <2 x float> %10, ptr %3, align 8
  %12 = invoke noundef nonnull align 4 dereferenceable(8) ptr @_ZN6d2Vec2aSERKS_(ptr noundef nonnull align 4 dereferenceable(8) %0, ptr noundef nonnull align 4 dereferenceable(8) %3)
          to label %13 unwind label %17

13:                                               ; preds = %11
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #6
  %14 = invoke noalias noundef nonnull dereferenceable(72) ptr @_Znwm(i64 noundef 72) #7
          to label %15 unwind label %19

15:                                               ; preds = %13
  call void @_ZN10d2AABBTreeC2Ev(ptr noundef nonnull align 8 dereferenceable(72) %14)
  %16 = getelementptr inbounds i8, ptr %0, i64 8
  store ptr %14, ptr %16, align 8, !tbaa !18
  ret void

17:                                               ; preds = %11, %2
  %18 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #6
  br label %21

19:                                               ; preds = %13
  %20 = landingpad { ptr, i32 }
          cleanup
  br label %21

21:                                               ; preds = %19, %17
  %.pn = phi { ptr, i32 } [ %20, %19 ], [ %18, %17 ]
  call void @_ZN16d2BlockAllocatorD1Ev(ptr noundef nonnull align 8 dereferenceable(128) %4) #6
  resume { ptr, i32 } %.pn
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN6d2Vec2C2Eff(ptr noundef nonnull align 4 dereferenceable(8), float noundef, float noundef) unnamed_addr #1 align 2

declare void @_ZN16d2BlockAllocatorC1Ev(ptr noundef nonnull align 8 dereferenceable(128)) unnamed_addr #2

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

declare <2 x float> @_ZNK6d2Vec2mlEf(ptr noundef nonnull align 4 dereferenceable(8), float noundef) local_unnamed_addr #2

declare i32 @__gxx_personality_v0(...)

declare noundef nonnull align 4 dereferenceable(8) ptr @_ZN6d2Vec2aSERKS_(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(8)) local_unnamed_addr #2

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

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znwm(i64 noundef) local_unnamed_addr #4

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

; Function Attrs: nounwind
declare void @_ZN16d2BlockAllocatorD1Ev(ptr noundef nonnull align 8 dereferenceable(128)) unnamed_addr #5

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 = { 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 = { "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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { nobuiltin allocsize(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 = { 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 #6 = { nounwind }
attributes #7 = { builtin allocsize(0) }

!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, !11, i64 144}
!6 = !{!"_ZTS7d2World", !7, i64 0, !11, i64 8, !12, i64 16, !11, i64 144, !13, i64 152, !11, i64 160, !13, i64 168, !11, i64 176}
!7 = !{!"_ZTS6d2Vec2", !8, i64 0, !8, i64 4}
!8 = !{!"float", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = !{!"any pointer", !9, i64 0}
!12 = !{!"_ZTS16d2BlockAllocator", !11, i64 0, !13, i64 8, !13, i64 12, !9, i64 16}
!13 = !{!"int", !9, i64 0}
!14 = !{!6, !13, i64 152}
!15 = !{!6, !11, i64 160}
!16 = !{!6, !13, i64 168}
!17 = !{!6, !11, i64 176}
!18 = !{!6, !11, i64 8}


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