; LLVM IR from avidbots/flatland :: flatland_server/src (geometry)

; 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.b2Vec2 = type { float, float }
%"struct.flatland_server::RotateTranslate" = type { double, double, double, double }

; Function Attrs: mustprogress uwtable
define dso_local <2 x float> @_ZN15flatland_server8Geometry9TransformERK6b2Vec2RKNS_15RotateTranslateE(ptr noundef nonnull align 4 dereferenceable(8) %0, ptr noundef nonnull align 8 dereferenceable(32) %1) #0 align 2 {
  %3 = alloca %struct.b2Vec2, align 4
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  call void @_ZN6b2Vec2C2Ev(ptr noundef nonnull align 4 dereferenceable(8) %3)
  %6 = load ptr, ptr %4, align 8, !tbaa !5
  %7 = getelementptr inbounds %struct.b2Vec2, ptr %6, i32 0, i32 0
  %8 = load float, ptr %7, align 4, !tbaa !9
  %9 = fpext float %8 to double
  %10 = load ptr, ptr %5, align 8, !tbaa !5
  %11 = getelementptr inbounds %"struct.flatland_server::RotateTranslate", ptr %10, i32 0, i32 2
  %12 = load double, ptr %11, align 8, !tbaa !12
  %13 = load ptr, ptr %4, align 8, !tbaa !5
  %14 = getelementptr inbounds %struct.b2Vec2, ptr %13, i32 0, i32 1
  %15 = load float, ptr %14, align 4, !tbaa !15
  %16 = fpext float %15 to double
  %17 = load ptr, ptr %5, align 8, !tbaa !5
  %18 = getelementptr inbounds %"struct.flatland_server::RotateTranslate", ptr %17, i32 0, i32 3
  %19 = load double, ptr %18, align 8, !tbaa !16
  %20 = fmul double %16, %19
  %21 = fneg double %20
  %22 = call double @llvm.fmuladd.f64(double %9, double %12, double %21)
  %23 = load ptr, ptr %5, align 8, !tbaa !5
  %24 = getelementptr inbounds %"struct.flatland_server::RotateTranslate", ptr %23, i32 0, i32 0
  %25 = load double, ptr %24, align 8, !tbaa !17
  %26 = fadd double %22, %25
  %27 = fptrunc double %26 to float
  %28 = getelementptr inbounds %struct.b2Vec2, ptr %3, i32 0, i32 0
  store float %27, ptr %28, align 4, !tbaa !9
  %29 = load ptr, ptr %4, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.b2Vec2, ptr %29, i32 0, i32 0
  %31 = load float, ptr %30, align 4, !tbaa !9
  %32 = fpext float %31 to double
  %33 = load ptr, ptr %5, align 8, !tbaa !5
  %34 = getelementptr inbounds %"struct.flatland_server::RotateTranslate", ptr %33, i32 0, i32 3
  %35 = load double, ptr %34, align 8, !tbaa !16
  %36 = load ptr, ptr %4, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.b2Vec2, ptr %36, i32 0, i32 1
  %38 = load float, ptr %37, align 4, !tbaa !15
  %39 = fpext float %38 to double
  %40 = load ptr, ptr %5, align 8, !tbaa !5
  %41 = getelementptr inbounds %"struct.flatland_server::RotateTranslate", ptr %40, i32 0, i32 2
  %42 = load double, ptr %41, align 8, !tbaa !12
  %43 = fmul double %39, %42
  %44 = call double @llvm.fmuladd.f64(double %32, double %35, double %43)
  %45 = load ptr, ptr %5, align 8, !tbaa !5
  %46 = getelementptr inbounds %"struct.flatland_server::RotateTranslate", ptr %45, i32 0, i32 1
  %47 = load double, ptr %46, align 8, !tbaa !18
  %48 = fadd double %44, %47
  %49 = fptrunc double %48 to float
  %50 = getelementptr inbounds %struct.b2Vec2, ptr %3, i32 0, i32 1
  store float %49, ptr %50, align 4, !tbaa !15
  %51 = load <2 x float>, ptr %3, align 4
  ret <2 x float> %51
}

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #2

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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }

!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 = !{!"_ZTS6b2Vec2", !11, i64 0, !11, i64 4}
!11 = !{!"float", !7, i64 0}
!12 = !{!13, !14, i64 16}
!13 = !{!"_ZTSN15flatland_server15RotateTranslateE", !14, i64 0, !14, i64 8, !14, i64 16, !14, i64 24}
!14 = !{!"double", !7, i64 0}
!15 = !{!10, !11, i64 4}
!16 = !{!13, !14, i64 24}
!17 = !{!13, !14, i64 0}
!18 = !{!13, !14, 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.b2Vec2 = type { float, float }

; Function Attrs: mustprogress nounwind uwtable
define dso_local <2 x float> @_ZN15flatland_server8Geometry9TransformERK6b2Vec2RKNS_15RotateTranslateE(ptr nocapture noundef nonnull readonly align 4 dereferenceable(8) %0, ptr nocapture noundef nonnull readonly align 8 dereferenceable(32) %1) local_unnamed_addr #0 align 2 {
  %3 = alloca %struct.b2Vec2, align 8
  call void @_ZN6b2Vec2C2Ev(ptr noundef nonnull align 4 dereferenceable(8) %3)
  %4 = load float, ptr %0, align 4, !tbaa !5
  %5 = fpext float %4 to double
  %6 = getelementptr inbounds i8, ptr %1, i64 16
  %7 = getelementptr inbounds i8, ptr %0, i64 4
  %8 = load float, ptr %7, align 4, !tbaa !10
  %9 = fpext float %8 to double
  %10 = load <2 x double>, ptr %6, align 8, !tbaa !11
  %11 = extractelement <2 x double> %10, i64 1
  %12 = fneg double %11
  %13 = shufflevector <2 x double> %10, <2 x double> poison, <2 x i32> <i32 poison, i32 0>
  %14 = insertelement <2 x double> %13, double %12, i64 0
  %15 = insertelement <2 x double> poison, double %9, i64 0
  %16 = shufflevector <2 x double> %15, <2 x double> poison, <2 x i32> zeroinitializer
  %17 = fmul <2 x double> %14, %16
  %18 = insertelement <2 x double> poison, double %5, i64 0
  %19 = shufflevector <2 x double> %18, <2 x double> poison, <2 x i32> zeroinitializer
  %20 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %19, <2 x double> %10, <2 x double> %17)
  %21 = load <2 x double>, ptr %1, align 8, !tbaa !11
  %22 = fadd <2 x double> %21, %20
  %23 = fptrunc <2 x double> %22 to <2 x float>
  store <2 x float> %23, ptr %3, align 8, !tbaa !13
  ret <2 x float> %23
}

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <2 x double> @llvm.fmuladd.v2f64(<2 x double>, <2 x double>, <2 x double>) #2

attributes #0 = { mustprogress nounwind 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }

!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 = !{!"_ZTS6b2Vec2", !7, i64 0, !7, i64 4}
!7 = !{!"float", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!6, !7, i64 4}
!11 = !{!12, !12, i64 0}
!12 = !{!"double", !8, i64 0}
!13 = !{!7, !7, i64 0}


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