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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #0

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef float @_Z7toFloatIiEfRKT_(ptr noundef nonnull align 4 dereferenceable(4)) #2

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK15SpaceCalculator15correctPositionER12RealVector2D(ptr noundef nonnull align 4 dereferenceable(16) %0, ptr noundef nonnull align 4 dereferenceable(8) %1) #4 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca %struct.IntVector2D, align 4
  %6 = alloca %struct.RealVector2D, align 4
  %7 = alloca %"class.std::initializer_list", align 8
  %8 = alloca [2 x float], align 4
  %9 = alloca %struct.RealVector2D, align 4
  %10 = alloca %"class.std::initializer_list", align 8
  %11 = alloca [2 x float], align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %12 = load ptr, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #6
  %13 = load ptr, ptr %4, align 8, !tbaa !5
  %14 = call i64 @_Z13toIntVector2DRK12RealVector2D(ptr noundef nonnull align 4 dereferenceable(8) %13)
  store i64 %14, ptr %5, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #6
  %15 = load ptr, ptr %4, align 8, !tbaa !5
  %16 = getelementptr inbounds %struct.RealVector2D, ptr %15, i32 0, i32 0
  %17 = load float, ptr %16, align 4, !tbaa !9
  %18 = getelementptr inbounds %struct.IntVector2D, ptr %5, i32 0, i32 0
  %19 = call noundef float @_Z7toFloatIiEfRKT_(ptr noundef nonnull align 4 dereferenceable(4) %18)
  %20 = fsub float %17, %19
  store float %20, ptr %8, align 4, !tbaa !12
  %21 = getelementptr inbounds float, ptr %8, i64 1
  %22 = load ptr, ptr %4, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.RealVector2D, ptr %22, i32 0, i32 1
  %24 = load float, ptr %23, align 4, !tbaa !13
  %25 = getelementptr inbounds %struct.IntVector2D, ptr %5, i32 0, i32 1
  %26 = call noundef float @_Z7toFloatIiEfRKT_(ptr noundef nonnull align 4 dereferenceable(4) %25)
  %27 = fsub float %24, %26
  store float %27, ptr %21, align 4, !tbaa !12
  %28 = getelementptr inbounds %"class.std::initializer_list", ptr %7, i32 0, i32 0
  store ptr %8, ptr %28, align 8, !tbaa !14
  %29 = getelementptr inbounds %"class.std::initializer_list", ptr %7, i32 0, i32 1
  store i64 2, ptr %29, align 8, !tbaa !17
  %30 = getelementptr inbounds { ptr, i64 }, ptr %7, i32 0, i32 0
  %31 = load ptr, ptr %30, align 8
  %32 = getelementptr inbounds { ptr, i64 }, ptr %7, i32 0, i32 1
  %33 = load i64, ptr %32, align 8
  call void @_ZN12RealVector2DC1ESt16initializer_listIfE(ptr noundef nonnull align 4 dereferenceable(8) %6, ptr %31, i64 %33)
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  %34 = getelementptr inbounds %class.SpaceCalculator, ptr %12, i32 0, i32 0
  call void @_ZN12_GLOBAL__N_118correctIntPositionER11IntVector2DRKS0_(ptr noundef nonnull align 4 dereferenceable(8) %5, ptr noundef nonnull align 4 dereferenceable(8) %34)
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #6
  %35 = getelementptr inbounds %struct.IntVector2D, ptr %5, i32 0, i32 0
  %36 = load i32, ptr %35, align 4, !tbaa !18
  %37 = sitofp i32 %36 to float
  %38 = getelementptr inbounds %struct.RealVector2D, ptr %6, i32 0, i32 0
  %39 = load float, ptr %38, align 4, !tbaa !9
  %40 = fadd float %37, %39
  store float %40, ptr %11, align 4, !tbaa !12
  %41 = getelementptr inbounds float, ptr %11, i64 1
  %42 = getelementptr inbounds %struct.IntVector2D, ptr %5, i32 0, i32 1
  %43 = load i32, ptr %42, align 4, !tbaa !21
  %44 = sitofp i32 %43 to float
  %45 = getelementptr inbounds %struct.RealVector2D, ptr %6, i32 0, i32 1
  %46 = load float, ptr %45, align 4, !tbaa !13
  %47 = fadd float %44, %46
  store float %47, ptr %41, align 4, !tbaa !12
  %48 = getelementptr inbounds %"class.std::initializer_list", ptr %10, i32 0, i32 0
  store ptr %11, ptr %48, align 8, !tbaa !14
  %49 = getelementptr inbounds %"class.std::initializer_list", ptr %10, i32 0, i32 1
  store i64 2, ptr %49, align 8, !tbaa !17
  %50 = getelementptr inbounds { ptr, i64 }, ptr %10, i32 0, i32 0
  %51 = load ptr, ptr %50, align 8
  %52 = getelementptr inbounds { ptr, i64 }, ptr %10, i32 0, i32 1
  %53 = load i64, ptr %52, align 8
  call void @_ZN12RealVector2DC1ESt16initializer_listIfE(ptr noundef nonnull align 4 dereferenceable(8) %9, ptr %51, i64 %53)
  %54 = load ptr, ptr %4, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %54, ptr align 4 %9, i64 8, i1 false), !tbaa.struct !22
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #6
  ret void
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local i64 @_Z13toIntVector2DRK12RealVector2D(ptr noundef nonnull align 4 dereferenceable(8)) #5

; Function Attrs: mustprogress uwtable
declare hidden void @_ZN12_GLOBAL__N_118correctIntPositionER11IntVector2DRKS0_(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(8)) #4

attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { "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 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 = { inlinehint 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 #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 = !{!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 = !{!"_ZTS12RealVector2D", !11, i64 0, !11, i64 4}
!11 = !{!"float", !7, i64 0}
!12 = !{!11, !11, i64 0}
!13 = !{!10, !11, i64 4}
!14 = !{!15, !6, i64 0}
!15 = !{!"_ZTSSt16initializer_listIfE", !6, i64 0, !16, i64 8}
!16 = !{!"long", !7, i64 0}
!17 = !{!15, !16, i64 8}
!18 = !{!19, !20, i64 0}
!19 = !{!"_ZTS11IntVector2D", !20, i64 0, !20, i64 4}
!20 = !{!"int", !7, i64 0}
!21 = !{!19, !20, i64 4}
!22 = !{i64 0, i64 4, !12, i64 4, i64 4, !12}


; 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.IntVector2D = type { i32, i32 }
%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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef float @_Z7toFloatIiEfRKT_(ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #1

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK15SpaceCalculator15correctPositionER12RealVector2D(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.IntVector2D, align 8
  %4 = alloca %struct.RealVector2D, align 8
  %5 = alloca [2 x float], align 4
  %6 = alloca %struct.RealVector2D, align 8
  %7 = alloca [2 x float], align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #5
  %8 = tail call i64 @_Z13toIntVector2DRK12RealVector2D(ptr noundef nonnull align 4 dereferenceable(8) %1)
  store i64 %8, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #5
  %9 = load float, ptr %1, align 4, !tbaa !5
  %10 = call noundef float @_Z7toFloatIiEfRKT_(ptr noundef nonnull align 4 dereferenceable(4) %3)
  %11 = fsub float %9, %10
  store float %11, ptr %5, align 4, !tbaa !10
  %12 = getelementptr inbounds i8, ptr %5, i64 4
  %13 = getelementptr inbounds i8, ptr %1, i64 4
  %14 = load float, ptr %13, align 4, !tbaa !11
  %15 = getelementptr inbounds i8, ptr %3, i64 4
  %16 = call noundef float @_Z7toFloatIiEfRKT_(ptr noundef nonnull align 4 dereferenceable(4) %15)
  %17 = fsub float %14, %16
  store float %17, ptr %12, align 4, !tbaa !10
  call void @_ZN12RealVector2DC1ESt16initializer_listIfE(ptr noundef nonnull align 4 dereferenceable(8) %4, ptr nonnull %5, i64 2)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #5
  call void @_ZN12_GLOBAL__N_118correctIntPositionER11IntVector2DRKS0_(ptr noundef nonnull align 4 dereferenceable(8) %3, ptr noundef nonnull align 4 dereferenceable(8) %0)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #5
  %18 = load <2 x i32>, ptr %3, align 8, !tbaa !12
  %19 = sitofp <2 x i32> %18 to <2 x float>
  %20 = load <2 x float>, ptr %4, align 8, !tbaa !10
  %21 = fadd <2 x float> %20, %19
  store <2 x float> %21, ptr %7, align 8, !tbaa !10
  call void @_ZN12RealVector2DC1ESt16initializer_listIfE(ptr noundef nonnull align 4 dereferenceable(8) %6, ptr nonnull %7, i64 2)
  %22 = load i64, ptr %6, align 8
  store i64 %22, ptr %1, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #5
  ret void
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local i64 @_Z13toIntVector2DRK12RealVector2D(ptr noundef nonnull align 4 dereferenceable(8)) local_unnamed_addr #4

; Function Attrs: mustprogress uwtable
declare hidden void @_ZN12_GLOBAL__N_118correctIntPositionER11IntVector2DRKS0_(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(8)) local_unnamed_addr #3

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { "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"="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 = { inlinehint 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 #5 = { 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, !7, i64 0}
!6 = !{!"_ZTS12RealVector2D", !7, i64 0, !7, i64 4}
!7 = !{!"float", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!7, !7, i64 0}
!11 = !{!6, !7, i64 4}
!12 = !{!13, !13, i64 0}
!13 = !{!"int", !8, i64 0}


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