; LLVM IR from ashishzero/karma :: src/modules/core/lin_maths.ll (Z25mm_rect_enclosing_capsuleRK7Capsule)

; 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.Mm_Rect = type { %union.Vec2, %union.Vec2 }
%union.Vec2 = type { %struct.anon.1 }
%struct.anon.1 = type { float, float }
%struct.Capsule = type { %union.Vec2, %union.Vec2, float }

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 4 dereferenceable(8) ptr @_ZpLR4Vec2S_(ptr noundef nonnull align 4 dereferenceable(8), <2 x float>) #0

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local <2 x float> @_Z4vec2f(float noundef) #1

; Function Attrs: mustprogress uwtable
define dso_local { <2 x float>, <2 x float> } @_Z25mm_rect_enclosing_capsuleRK7Capsule(ptr noundef nonnull align 4 dereferenceable(20) %0) #2 {
  %2 = alloca %struct.Mm_Rect, align 4
  %3 = alloca ptr, align 8
  %4 = alloca %union.Vec2, align 4
  %5 = alloca %union.Vec2, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  %6 = load ptr, ptr %3, align 8, !tbaa !5
  %7 = getelementptr inbounds %struct.Capsule, ptr %6, i32 0, i32 0
  %8 = getelementptr inbounds %struct.anon.1, ptr %7, i32 0, i32 0
  %9 = load float, ptr %8, align 4, !tbaa !9
  %10 = load ptr, ptr %3, align 8, !tbaa !5
  %11 = getelementptr inbounds %struct.Capsule, ptr %10, i32 0, i32 1
  %12 = getelementptr inbounds %struct.anon.1, ptr %11, i32 0, i32 0
  %13 = load float, ptr %12, align 4, !tbaa !9
  %14 = fcmp ogt float %9, %13
  br i1 %14, label %15, label %28

15:                                               ; preds = %1
  %16 = load ptr, ptr %3, align 8, !tbaa !5
  %17 = getelementptr inbounds %struct.Capsule, ptr %16, i32 0, i32 1
  %18 = getelementptr inbounds %struct.anon.1, ptr %17, i32 0, i32 0
  %19 = load float, ptr %18, align 4, !tbaa !9
  %20 = getelementptr inbounds %struct.Mm_Rect, ptr %2, i32 0, i32 0
  %21 = getelementptr inbounds %struct.anon.1, ptr %20, i32 0, i32 0
  store float %19, ptr %21, align 4, !tbaa !9
  %22 = load ptr, ptr %3, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.Capsule, ptr %22, i32 0, i32 0
  %24 = getelementptr inbounds %struct.anon.1, ptr %23, i32 0, i32 0
  %25 = load float, ptr %24, align 4, !tbaa !9
  %26 = getelementptr inbounds %struct.Mm_Rect, ptr %2, i32 0, i32 1
  %27 = getelementptr inbounds %struct.anon.1, ptr %26, i32 0, i32 0
  store float %25, ptr %27, align 4, !tbaa !9
  br label %41

28:                                               ; preds = %1
  %29 = load ptr, ptr %3, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.Capsule, ptr %29, i32 0, i32 0
  %31 = getelementptr inbounds %struct.anon.1, ptr %30, i32 0, i32 0
  %32 = load float, ptr %31, align 4, !tbaa !9
  %33 = getelementptr inbounds %struct.Mm_Rect, ptr %2, i32 0, i32 0
  %34 = getelementptr inbounds %struct.anon.1, ptr %33, i32 0, i32 0
  store float %32, ptr %34, align 4, !tbaa !9
  %35 = load ptr, ptr %3, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct.Capsule, ptr %35, i32 0, i32 1
  %37 = getelementptr inbounds %struct.anon.1, ptr %36, i32 0, i32 0
  %38 = load float, ptr %37, align 4, !tbaa !9
  %39 = getelementptr inbounds %struct.Mm_Rect, ptr %2, i32 0, i32 1
  %40 = getelementptr inbounds %struct.anon.1, ptr %39, i32 0, i32 0
  store float %38, ptr %40, align 4, !tbaa !9
  br label %41

41:                                               ; preds = %28, %15
  %42 = load ptr, ptr %3, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.Capsule, ptr %42, i32 0, i32 0
  %44 = getelementptr inbounds %struct.anon.1, ptr %43, i32 0, i32 1
  %45 = load float, ptr %44, align 4, !tbaa !9
  %46 = load ptr, ptr %3, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.Capsule, ptr %46, i32 0, i32 1
  %48 = getelementptr inbounds %struct.anon.1, ptr %47, i32 0, i32 1
  %49 = load float, ptr %48, align 4, !tbaa !9
  %50 = fcmp ogt float %45, %49
  br i1 %50, label %51, label %64

51:                                               ; preds = %41
  %52 = load ptr, ptr %3, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.Capsule, ptr %52, i32 0, i32 1
  %54 = getelementptr inbounds %struct.anon.1, ptr %53, i32 0, i32 1
  %55 = load float, ptr %54, align 4, !tbaa !9
  %56 = getelementptr inbounds %struct.Mm_Rect, ptr %2, i32 0, i32 0
  %57 = getelementptr inbounds %struct.anon.1, ptr %56, i32 0, i32 1
  store float %55, ptr %57, align 4, !tbaa !9
  %58 = load ptr, ptr %3, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.Capsule, ptr %58, i32 0, i32 0
  %60 = getelementptr inbounds %struct.anon.1, ptr %59, i32 0, i32 1
  %61 = load float, ptr %60, align 4, !tbaa !9
  %62 = getelementptr inbounds %struct.Mm_Rect, ptr %2, i32 0, i32 1
  %63 = getelementptr inbounds %struct.anon.1, ptr %62, i32 0, i32 1
  store float %61, ptr %63, align 4, !tbaa !9
  br label %77

64:                                               ; preds = %41
  %65 = load ptr, ptr %3, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct.Capsule, ptr %65, i32 0, i32 0
  %67 = getelementptr inbounds %struct.anon.1, ptr %66, i32 0, i32 1
  %68 = load float, ptr %67, align 4, !tbaa !9
  %69 = getelementptr inbounds %struct.Mm_Rect, ptr %2, i32 0, i32 0
  %70 = getelementptr inbounds %struct.anon.1, ptr %69, i32 0, i32 1
  store float %68, ptr %70, align 4, !tbaa !9
  %71 = load ptr, ptr %3, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct.Capsule, ptr %71, i32 0, i32 1
  %73 = getelementptr inbounds %struct.anon.1, ptr %72, i32 0, i32 1
  %74 = load float, ptr %73, align 4, !tbaa !9
  %75 = getelementptr inbounds %struct.Mm_Rect, ptr %2, i32 0, i32 1
  %76 = getelementptr inbounds %struct.anon.1, ptr %75, i32 0, i32 1
  store float %74, ptr %76, align 4, !tbaa !9
  br label %77

77:                                               ; preds = %64, %51
  %78 = load ptr, ptr %3, align 8, !tbaa !5
  %79 = getelementptr inbounds %struct.Capsule, ptr %78, i32 0, i32 2
  %80 = load float, ptr %79, align 4, !tbaa !10
  %81 = call <2 x float> @_Z4vec2f(float noundef %80)
  %82 = getelementptr inbounds %union.Vec2, ptr %4, i32 0, i32 0
  store <2 x float> %81, ptr %82, align 4
  %83 = getelementptr inbounds %struct.Mm_Rect, ptr %2, i32 0, i32 0
  %84 = getelementptr inbounds %union.Vec2, ptr %4, i32 0, i32 0
  %85 = load <2 x float>, ptr %84, align 4
  %86 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZmIR4Vec2S_(ptr noundef nonnull align 4 dereferenceable(8) %83, <2 x float> %85)
  %87 = load ptr, ptr %3, align 8, !tbaa !5
  %88 = getelementptr inbounds %struct.Capsule, ptr %87, i32 0, i32 2
  %89 = load float, ptr %88, align 4, !tbaa !10
  %90 = call <2 x float> @_Z4vec2f(float noundef %89)
  %91 = getelementptr inbounds %union.Vec2, ptr %5, i32 0, i32 0
  store <2 x float> %90, ptr %91, align 4
  %92 = getelementptr inbounds %struct.Mm_Rect, ptr %2, i32 0, i32 1
  %93 = getelementptr inbounds %union.Vec2, ptr %5, i32 0, i32 0
  %94 = load <2 x float>, ptr %93, align 4
  %95 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZpLR4Vec2S_(ptr noundef nonnull align 4 dereferenceable(8) %92, <2 x float> %94)
  %96 = load { <2 x float>, <2 x float> }, ptr %2, align 4
  ret { <2 x float>, <2 x float> } %96
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 4 dereferenceable(8) ptr @_ZmIR4Vec2S_(ptr noundef nonnull align 4 dereferenceable(8), <2 x float>) #0

attributes #0 = { inlinehint 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 = { inlinehint 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 = { 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 = !{!7, !7, i64 0}
!10 = !{!11, !12, i64 16}
!11 = !{!"_ZTS7Capsule", !7, i64 0, !7, i64 8, !12, i64 16}
!12 = !{!"float", !7, i64 0}


; 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.Mm_Rect = type { %union.Vec2, %union.Vec2 }
%union.Vec2 = type { %struct.anon.1 }
%struct.anon.1 = type { float, float }

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 4 dereferenceable(8) ptr @_ZpLR4Vec2S_(ptr noundef nonnull align 4 dereferenceable(8), <2 x float>) local_unnamed_addr #0

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local <2 x float> @_Z4vec2f(float noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
define dso_local { <2 x float>, <2 x float> } @_Z25mm_rect_enclosing_capsuleRK7Capsule(ptr nocapture noundef nonnull readonly align 4 dereferenceable(20) %0) local_unnamed_addr #2 {
  %2 = alloca %struct.Mm_Rect, align 16
  %3 = getelementptr inbounds i8, ptr %0, i64 8
  %4 = getelementptr inbounds i8, ptr %2, i64 8
  %5 = load <2 x float>, ptr %0, align 4, !tbaa !5
  %6 = load <2 x float>, ptr %3, align 4, !tbaa !5
  %7 = fcmp ogt <2 x float> %5, %6
  %8 = shufflevector <2 x i1> %7, <2 x i1> poison, <4 x i32> <i32 0, i32 1, i32 0, i32 1>
  %9 = shufflevector <2 x float> %6, <2 x float> %5, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
  %10 = shufflevector <2 x float> %6, <2 x float> %5, <4 x i32> <i32 2, i32 3, i32 0, i32 1>
  %11 = select <4 x i1> %8, <4 x float> %9, <4 x float> %10
  store <4 x float> %11, ptr %2, align 16
  %12 = getelementptr inbounds i8, ptr %0, i64 16
  %13 = load float, ptr %12, align 4, !tbaa !8
  %14 = tail call <2 x float> @_Z4vec2f(float noundef %13)
  %15 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZmIR4Vec2S_(ptr noundef nonnull align 4 dereferenceable(8) %2, <2 x float> %14)
  %16 = load float, ptr %12, align 4, !tbaa !8
  %17 = call <2 x float> @_Z4vec2f(float noundef %16)
  %18 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZpLR4Vec2S_(ptr noundef nonnull align 4 dereferenceable(8) %4, <2 x float> %17)
  %.fca.0.load = load <2 x float>, ptr %2, align 16
  %.fca.0.insert = insertvalue { <2 x float>, <2 x float> } poison, <2 x float> %.fca.0.load, 0
  %.fca.1.load = load <2 x float>, ptr %4, align 8
  %.fca.1.insert = insertvalue { <2 x float>, <2 x float> } %.fca.0.insert, <2 x float> %.fca.1.load, 1
  ret { <2 x float>, <2 x float> } %.fca.1.insert
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 4 dereferenceable(8) ptr @_ZmIR4Vec2S_(ptr noundef nonnull align 4 dereferenceable(8), <2 x float>) local_unnamed_addr #0

attributes #0 = { inlinehint 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 = { inlinehint 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 = { 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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !10, i64 16}
!9 = !{!"_ZTS7Capsule", !6, i64 0, !6, i64 8, !10, i64 16}
!10 = !{!"float", !6, i64 0}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,InferAlignmentPass,InstCombinePass,JumpThreadingPass,MergedLoadStoreMotionPass,PostOrderFunctionAttrsPass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass