; LLVM IR from acrlw/Physics2D :: Physics2D/source/math/physics2d_matrix2x2.ll (ZN9Physics2D9Matrix2x26invertERS0_)

; 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.Physics2D::Matrix2x2" = type { %"struct.Physics2D::Vector2", %"struct.Physics2D::Vector2" }
%"struct.Physics2D::Vector2" = type { float, float }

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN9Physics2D9realEqualERKfS1_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #2

; Function Attrs: mustprogress uwtable
declare dso_local noundef float @_ZNK9Physics2D9Matrix2x211determinantEv(ptr noundef nonnull align 4 dereferenceable(16)) #1 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN9Physics2D8realSwapERfS0_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #3

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN9Physics2D9Matrix2x26invertERS0_(ptr noundef nonnull align 4 dereferenceable(16) %0) #1 align 2 {
  %2 = alloca i1, align 1
  %3 = alloca ptr, align 8
  %4 = alloca float, align 4
  %5 = alloca float, align 4
  %6 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #4
  %7 = load ptr, ptr %3, align 8, !tbaa !5
  %8 = call noundef float @_ZNK9Physics2D9Matrix2x211determinantEv(ptr noundef nonnull align 4 dereferenceable(16) %7)
  store float %8, ptr %4, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  store float 0.000000e+00, ptr %5, align 4, !tbaa !9
  %9 = call noundef zeroext i1 @_ZN9Physics2D9realEqualERKfS1_(ptr noundef nonnull align 4 dereferenceable(4) %4, ptr noundef nonnull align 4 dereferenceable(4) %5)
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  br i1 %9, label %10, label %11

10:                                               ; preds = %1
  store i1 false, ptr %2, align 1
  store i32 1, ptr %6, align 4
  br label %30

11:                                               ; preds = %1
  %12 = load ptr, ptr %3, align 8, !tbaa !5
  %13 = getelementptr inbounds %"struct.Physics2D::Matrix2x2", ptr %12, i32 0, i32 0
  %14 = getelementptr inbounds %"struct.Physics2D::Vector2", ptr %13, i32 0, i32 0
  %15 = load ptr, ptr %3, align 8, !tbaa !5
  %16 = getelementptr inbounds %"struct.Physics2D::Matrix2x2", ptr %15, i32 0, i32 1
  %17 = getelementptr inbounds %"struct.Physics2D::Vector2", ptr %16, i32 0, i32 1
  call void @_ZN9Physics2D8realSwapERfS0_(ptr noundef nonnull align 4 dereferenceable(4) %14, ptr noundef nonnull align 4 dereferenceable(4) %17)
  %18 = load ptr, ptr %3, align 8, !tbaa !5
  %19 = getelementptr inbounds %"struct.Physics2D::Matrix2x2", ptr %18, i32 0, i32 0
  %20 = getelementptr inbounds %"struct.Physics2D::Vector2", ptr %19, i32 0, i32 1
  %21 = load float, ptr %20, align 4, !tbaa !11
  %22 = fmul float %21, -1.000000e+00
  store float %22, ptr %20, align 4, !tbaa !11
  %23 = load ptr, ptr %3, align 8, !tbaa !5
  %24 = getelementptr inbounds %"struct.Physics2D::Matrix2x2", ptr %23, i32 0, i32 1
  %25 = getelementptr inbounds %"struct.Physics2D::Vector2", ptr %24, i32 0, i32 0
  %26 = load float, ptr %25, align 4, !tbaa !14
  %27 = fmul float %26, -1.000000e+00
  store float %27, ptr %25, align 4, !tbaa !14
  %28 = load ptr, ptr %3, align 8, !tbaa !5
  %29 = call noundef nonnull align 4 dereferenceable(16) ptr @_ZN9Physics2D9Matrix2x2dVERKf(ptr noundef nonnull align 4 dereferenceable(16) %28, ptr noundef nonnull align 4 dereferenceable(4) %4)
  store i1 true, ptr %2, align 1
  store i32 1, ptr %6, align 4
  br label %30

30:                                               ; preds = %11, %10
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #4
  %31 = load i1, ptr %2, align 1
  ret i1 %31
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 #3 = { 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 #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, !10, i64 0}
!10 = !{!"float", !7, i64 0}
!11 = !{!12, !10, i64 4}
!12 = !{!"_ZTSN9Physics2D9Matrix2x2E", !13, i64 0, !13, i64 8}
!13 = !{!"_ZTSN9Physics2D7Vector2E", !10, i64 0, !10, i64 4}
!14 = !{!12, !10, 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"

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

; 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
declare dso_local noundef nonnull align 4 dereferenceable(16) ptr @_ZN9Physics2D9Matrix2x2dVERKf(ptr noundef nonnull align 4 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #1 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN9Physics2D9realEqualERKfS1_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
declare dso_local noundef float @_ZNK9Physics2D9Matrix2x211determinantEv(ptr noundef nonnull align 4 dereferenceable(16)) local_unnamed_addr #1 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN9Physics2D8realSwapERfS0_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #3

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN9Physics2D9Matrix2x26invertERS0_(ptr noundef nonnull align 4 dereferenceable(16) %0) local_unnamed_addr #1 align 2 {
  %2 = alloca float, align 4
  %3 = alloca float, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #4
  %4 = tail call noundef float @_ZNK9Physics2D9Matrix2x211determinantEv(ptr noundef nonnull align 4 dereferenceable(16) %0)
  store float %4, ptr %2, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #4
  store float 0.000000e+00, ptr %3, align 4, !tbaa !5
  %5 = call noundef zeroext i1 @_ZN9Physics2D9realEqualERKfS1_(ptr noundef nonnull align 4 dereferenceable(4) %2, ptr noundef nonnull align 4 dereferenceable(4) %3)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #4
  br i1 %5, label %12, label %6

6:                                                ; preds = %1
  %7 = getelementptr inbounds i8, ptr %0, i64 12
  call void @_ZN9Physics2D8realSwapERfS0_(ptr noundef nonnull align 4 dereferenceable(4) %0, ptr noundef nonnull align 4 dereferenceable(4) %7)
  %8 = getelementptr inbounds i8, ptr %0, i64 4
  %9 = load <2 x float>, ptr %8, align 4, !tbaa !5
  %10 = fneg <2 x float> %9
  store <2 x float> %10, ptr %8, align 4, !tbaa !5
  %11 = call noundef nonnull align 4 dereferenceable(16) ptr @_ZN9Physics2D9Matrix2x2dVERKf(ptr noundef nonnull align 4 dereferenceable(16) %0, ptr noundef nonnull align 4 dereferenceable(4) %2)
  br label %12

12:                                               ; preds = %1, %6
  %.0 = xor i1 %5, true
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #4
  ret i1 %.0
}

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 #3 = { 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 #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,InferFunctionAttrsPass,InstCombinePass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass