; LLVM IR from chrxh/alien :: source/EngineInterface (SpaceCalculator)

; 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.RealVector2D = type { float, float }
%"class.std::initializer_list" = type { ptr, i64 }
%class.SpaceCalculator = type { %struct.IntVector2D, %struct.RealVector2D }
%struct.IntVector2D = type { i32, i32 }

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

declare void @_ZN12RealVector2DC1ESt16initializer_listIfE(ptr noundef nonnull align 4 dereferenceable(8), ptr, i64) unnamed_addr #1

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK15SpaceCalculator15correctPositionER12RealVector2D(ptr noundef nonnull align 4 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(8)) #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local <2 x float> @_ZNK15SpaceCalculator21getCorrectedDirectionERK12RealVector2D(ptr noundef nonnull align 4 dereferenceable(16) %0, ptr noundef nonnull align 4 dereferenceable(8) %1) #3 align 2 {
  %3 = alloca %struct.RealVector2D, align 4
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca %struct.RealVector2D, align 4
  %7 = alloca %struct.RealVector2D, align 4
  %8 = alloca %"class.std::initializer_list", align 8
  %9 = alloca [2 x float], align 4
  %10 = alloca %struct.RealVector2D, align 4
  %11 = alloca %"class.std::initializer_list", align 8
  %12 = alloca [2 x float], align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  %13 = load ptr, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #4
  %14 = load ptr, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  %15 = getelementptr inbounds %class.SpaceCalculator, ptr %13, i32 0, i32 1
  %16 = getelementptr inbounds %struct.RealVector2D, ptr %15, i32 0, i32 0
  %17 = load float, ptr %16, align 4, !tbaa !9
  %18 = fdiv float %17, 2.000000e+00
  store float %18, ptr %9, align 4, !tbaa !15
  %19 = getelementptr inbounds float, ptr %9, i64 1
  %20 = getelementptr inbounds %class.SpaceCalculator, ptr %13, i32 0, i32 1
  %21 = getelementptr inbounds %struct.RealVector2D, ptr %20, i32 0, i32 1
  %22 = load float, ptr %21, align 4, !tbaa !16
  %23 = fdiv float %22, 2.000000e+00
  store float %23, ptr %19, align 4, !tbaa !15
  %24 = getelementptr inbounds %"class.std::initializer_list", ptr %8, i32 0, i32 0
  store ptr %9, ptr %24, align 8, !tbaa !17
  %25 = getelementptr inbounds %"class.std::initializer_list", ptr %8, i32 0, i32 1
  store i64 2, ptr %25, align 8, !tbaa !20
  %26 = getelementptr inbounds { ptr, i64 }, ptr %8, i32 0, i32 0
  %27 = load ptr, ptr %26, align 8
  %28 = getelementptr inbounds { ptr, i64 }, ptr %8, i32 0, i32 1
  %29 = load i64, ptr %28, align 8
  call void @_ZN12RealVector2DC1ESt16initializer_listIfE(ptr noundef nonnull align 4 dereferenceable(8) %7, ptr %27, i64 %29)
  %30 = call <2 x float> @_ZNK12RealVector2DplERKS_(ptr noundef nonnull align 4 dereferenceable(8) %14, ptr noundef nonnull align 4 dereferenceable(8) %7)
  store <2 x float> %30, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  call void @_ZNK15SpaceCalculator15correctPositionER12RealVector2D(ptr noundef nonnull align 4 dereferenceable(16) %13, ptr noundef nonnull align 4 dereferenceable(8) %6)
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #4
  %31 = getelementptr inbounds %class.SpaceCalculator, ptr %13, i32 0, i32 1
  %32 = getelementptr inbounds %struct.RealVector2D, ptr %31, i32 0, i32 0
  %33 = load float, ptr %32, align 4, !tbaa !9
  %34 = fdiv float %33, 2.000000e+00
  store float %34, ptr %12, align 4, !tbaa !15
  %35 = getelementptr inbounds float, ptr %12, i64 1
  %36 = getelementptr inbounds %class.SpaceCalculator, ptr %13, i32 0, i32 1
  %37 = getelementptr inbounds %struct.RealVector2D, ptr %36, i32 0, i32 1
  %38 = load float, ptr %37, align 4, !tbaa !16
  %39 = fdiv float %38, 2.000000e+00
  store float %39, ptr %35, align 4, !tbaa !15
  %40 = getelementptr inbounds %"class.std::initializer_list", ptr %11, i32 0, i32 0
  store ptr %12, ptr %40, align 8, !tbaa !17
  %41 = getelementptr inbounds %"class.std::initializer_list", ptr %11, i32 0, i32 1
  store i64 2, ptr %41, align 8, !tbaa !20
  %42 = getelementptr inbounds { ptr, i64 }, ptr %11, i32 0, i32 0
  %43 = load ptr, ptr %42, align 8
  %44 = getelementptr inbounds { ptr, i64 }, ptr %11, i32 0, i32 1
  %45 = load i64, ptr %44, align 8
  call void @_ZN12RealVector2DC1ESt16initializer_listIfE(ptr noundef nonnull align 4 dereferenceable(8) %10, ptr %43, i64 %45)
  %46 = call <2 x float> @_ZNK12RealVector2DmiERKS_(ptr noundef nonnull align 4 dereferenceable(8) %6, ptr noundef nonnull align 4 dereferenceable(8) %10)
  store <2 x float> %46, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  %47 = load <2 x float>, ptr %3, align 4
  ret <2 x float> %47
}

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 = { 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 #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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !14, i64 8}
!10 = !{!"_ZTS15SpaceCalculator", !11, i64 0, !13, i64 8}
!11 = !{!"_ZTS11IntVector2D", !12, i64 0, !12, i64 4}
!12 = !{!"int", !7, i64 0}
!13 = !{!"_ZTS12RealVector2D", !14, i64 0, !14, i64 4}
!14 = !{!"float", !7, i64 0}
!15 = !{!14, !14, i64 0}
!16 = !{!10, !14, i64 12}
!17 = !{!18, !6, i64 0}
!18 = !{!"_ZTSSt16initializer_listIfE", !6, i64 0, !19, i64 8}
!19 = !{!"long", !7, i64 0}
!20 = !{!18, !19, 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.RealVector2D = type { float, float }

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

declare void @_ZN12RealVector2DC1ESt16initializer_listIfE(ptr noundef nonnull align 4 dereferenceable(8), ptr, i64) unnamed_addr #1

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK15SpaceCalculator15correctPositionER12RealVector2D(ptr noundef nonnull align 4 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(8)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local <2 x float> @_ZNK15SpaceCalculator21getCorrectedDirectionERK12RealVector2D(ptr noundef nonnull align 4 dereferenceable(16) %0, ptr noundef nonnull align 4 dereferenceable(8) %1) local_unnamed_addr #3 align 2 {
  %3 = alloca %struct.RealVector2D, align 8
  %4 = alloca %struct.RealVector2D, align 4
  %5 = alloca [2 x float], align 8
  %6 = alloca %struct.RealVector2D, align 4
  %7 = alloca [2 x float], align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #4
  %8 = getelementptr inbounds i8, ptr %0, i64 8
  %9 = load <2 x float>, ptr %8, align 4, !tbaa !5
  %10 = fmul <2 x float> %9, <float 5.000000e-01, float 5.000000e-01>
  store <2 x float> %10, ptr %5, align 8, !tbaa !5
  call void @_ZN12RealVector2DC1ESt16initializer_listIfE(ptr noundef nonnull align 4 dereferenceable(8) %4, ptr nonnull %5, i64 2)
  %11 = call <2 x float> @_ZNK12RealVector2DplERKS_(ptr noundef nonnull align 4 dereferenceable(8) %1, ptr noundef nonnull align 4 dereferenceable(8) %4)
  store <2 x float> %11, ptr %3, align 8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #4
  call void @_ZNK15SpaceCalculator15correctPositionER12RealVector2D(ptr noundef nonnull align 4 dereferenceable(16) %0, ptr noundef nonnull align 4 dereferenceable(8) %3)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #4
  %12 = load <2 x float>, ptr %8, align 4, !tbaa !5
  %13 = fmul <2 x float> %12, <float 5.000000e-01, float 5.000000e-01>
  store <2 x float> %13, ptr %7, align 8, !tbaa !5
  call void @_ZN12RealVector2DC1ESt16initializer_listIfE(ptr noundef nonnull align 4 dereferenceable(8) %6, ptr nonnull %7, i64 2)
  %14 = call <2 x float> @_ZNK12RealVector2DmiERKS_(ptr noundef nonnull align 4 dereferenceable(8) %3, ptr noundef nonnull align 4 dereferenceable(8) %6)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #4
  ret <2 x float> %14
}

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 = { 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 #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 = !{!"float", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}


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