; 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 nounwind uwtable
declare dso_local void @_ZN6b2Vec2C2Ev(ptr noundef nonnull align 4 dereferenceable(8)) unnamed_addr #0 align 2

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

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

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

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


; 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
declare dso_local void @_ZN6b2Vec2C2Ev(ptr noundef nonnull align 4 dereferenceable(8)) unnamed_addr #0 align 2

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

; 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"="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 #1 = { 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 #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 = !{!11, !12, i64 0}
!11 = !{!"_ZTSN15flatland_server15RotateTranslateE", !12, i64 0, !12, i64 8, !12, i64 16, !12, i64 24}
!12 = !{!"double", !8, i64 0}
!13 = !{!6, !7, i64 4}
!14 = !{!11, !12, i64 8}
!15 = !{!12, !12, i64 0}
!16 = !{!7, !7, i64 0}


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