; LLVM IR from unitreerobotics/kinect_teleoperate :: src/extern/glfw/src/examples (boing)

; 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.vertex_t = type { float, 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: nounwind uwtable
define dso_local void @CrossProduct(<2 x float> %0, float %1, <2 x float> %2, float %3, <2 x float> %4, float %5, ptr noundef %6) #1 {
  %8 = alloca %struct.vertex_t, align 4
  %9 = alloca { <2 x float>, float }, align 4
  %10 = alloca %struct.vertex_t, align 4
  %11 = alloca { <2 x float>, float }, align 4
  %12 = alloca %struct.vertex_t, align 4
  %13 = alloca { <2 x float>, float }, align 4
  %14 = alloca ptr, align 8
  %15 = alloca float, align 4
  %16 = alloca float, align 4
  %17 = alloca float, align 4
  %18 = alloca float, align 4
  %19 = alloca float, align 4
  %20 = alloca float, align 4
  %21 = getelementptr inbounds { <2 x float>, float }, ptr %9, i32 0, i32 0
  store <2 x float> %0, ptr %21, align 4
  %22 = getelementptr inbounds { <2 x float>, float }, ptr %9, i32 0, i32 1
  store float %1, ptr %22, align 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %8, ptr align 4 %9, i64 12, i1 false)
  %23 = getelementptr inbounds { <2 x float>, float }, ptr %11, i32 0, i32 0
  store <2 x float> %2, ptr %23, align 4
  %24 = getelementptr inbounds { <2 x float>, float }, ptr %11, i32 0, i32 1
  store float %3, ptr %24, align 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %10, ptr align 4 %11, i64 12, i1 false)
  %25 = getelementptr inbounds { <2 x float>, float }, ptr %13, i32 0, i32 0
  store <2 x float> %4, ptr %25, align 4
  %26 = getelementptr inbounds { <2 x float>, float }, ptr %13, i32 0, i32 1
  store float %5, ptr %26, align 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %12, ptr align 4 %13, i64 12, i1 false)
  store ptr %6, ptr %14, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #4
  %27 = getelementptr inbounds %struct.vertex_t, ptr %10, i32 0, i32 0
  %28 = load float, ptr %27, align 4, !tbaa !9
  %29 = getelementptr inbounds %struct.vertex_t, ptr %8, i32 0, i32 0
  %30 = load float, ptr %29, align 4, !tbaa !9
  %31 = fsub float %28, %30
  store float %31, ptr %15, align 4, !tbaa !12
  %32 = getelementptr inbounds %struct.vertex_t, ptr %10, i32 0, i32 1
  %33 = load float, ptr %32, align 4, !tbaa !13
  %34 = getelementptr inbounds %struct.vertex_t, ptr %8, i32 0, i32 1
  %35 = load float, ptr %34, align 4, !tbaa !13
  %36 = fsub float %33, %35
  store float %36, ptr %16, align 4, !tbaa !12
  %37 = getelementptr inbounds %struct.vertex_t, ptr %10, i32 0, i32 1
  %38 = load float, ptr %37, align 4, !tbaa !13
  %39 = getelementptr inbounds %struct.vertex_t, ptr %8, i32 0, i32 2
  %40 = load float, ptr %39, align 4, !tbaa !14
  %41 = fsub float %38, %40
  store float %41, ptr %17, align 4, !tbaa !12
  %42 = getelementptr inbounds %struct.vertex_t, ptr %12, i32 0, i32 0
  %43 = load float, ptr %42, align 4, !tbaa !9
  %44 = getelementptr inbounds %struct.vertex_t, ptr %8, i32 0, i32 0
  %45 = load float, ptr %44, align 4, !tbaa !9
  %46 = fsub float %43, %45
  store float %46, ptr %18, align 4, !tbaa !12
  %47 = getelementptr inbounds %struct.vertex_t, ptr %12, i32 0, i32 1
  %48 = load float, ptr %47, align 4, !tbaa !13
  %49 = getelementptr inbounds %struct.vertex_t, ptr %8, i32 0, i32 1
  %50 = load float, ptr %49, align 4, !tbaa !13
  %51 = fsub float %48, %50
  store float %51, ptr %19, align 4, !tbaa !12
  %52 = getelementptr inbounds %struct.vertex_t, ptr %12, i32 0, i32 2
  %53 = load float, ptr %52, align 4, !tbaa !14
  %54 = getelementptr inbounds %struct.vertex_t, ptr %8, i32 0, i32 2
  %55 = load float, ptr %54, align 4, !tbaa !14
  %56 = fsub float %53, %55
  store float %56, ptr %20, align 4, !tbaa !12
  %57 = load float, ptr %16, align 4, !tbaa !12
  %58 = load float, ptr %20, align 4, !tbaa !12
  %59 = load float, ptr %19, align 4, !tbaa !12
  %60 = load float, ptr %17, align 4, !tbaa !12
  %61 = fmul float %59, %60
  %62 = fneg float %61
  %63 = call float @llvm.fmuladd.f32(float %57, float %58, float %62)
  %64 = load ptr, ptr %14, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct.vertex_t, ptr %64, i32 0, i32 0
  store float %63, ptr %65, align 4, !tbaa !9
  %66 = load float, ptr %17, align 4, !tbaa !12
  %67 = load float, ptr %18, align 4, !tbaa !12
  %68 = load float, ptr %20, align 4, !tbaa !12
  %69 = load float, ptr %15, align 4, !tbaa !12
  %70 = fmul float %68, %69
  %71 = fneg float %70
  %72 = call float @llvm.fmuladd.f32(float %66, float %67, float %71)
  %73 = load ptr, ptr %14, align 8, !tbaa !5
  %74 = getelementptr inbounds %struct.vertex_t, ptr %73, i32 0, i32 1
  store float %72, ptr %74, align 4, !tbaa !13
  %75 = load float, ptr %15, align 4, !tbaa !12
  %76 = load float, ptr %19, align 4, !tbaa !12
  %77 = load float, ptr %18, align 4, !tbaa !12
  %78 = load float, ptr %16, align 4, !tbaa !12
  %79 = fmul float %77, %78
  %80 = fneg float %79
  %81 = call float @llvm.fmuladd.f32(float %75, float %76, float %80)
  %82 = load ptr, ptr %14, align 8, !tbaa !5
  %83 = getelementptr inbounds %struct.vertex_t, ptr %82, i32 0, i32 2
  store float %81, ptr %83, align 4, !tbaa !14
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #4
  ret void
}

; 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) #2

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #3

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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/C++ TBAA"}
!9 = !{!10, !11, i64 0}
!10 = !{!"", !11, i64 0, !11, i64 4, !11, i64 8}
!11 = !{!"float", !7, i64 0}
!12 = !{!11, !11, i64 0}
!13 = !{!10, !11, i64 4}
!14 = !{!10, !11, 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 nofree norecurse nosync nounwind willreturn memory(argmem: write) uwtable
define dso_local void @CrossProduct(<2 x float> %0, float %1, <2 x float> %2, float %3, <2 x float> %4, float %5, ptr nocapture noundef writeonly %6) local_unnamed_addr #0 {
  %8 = fsub <2 x float> %2, %0
  %9 = extractelement <2 x float> %8, i64 1
  %10 = fsub float %5, %1
  %11 = getelementptr inbounds i8, ptr %6, i64 4
  %12 = insertelement <2 x float> %0, float %1, i64 1
  %13 = fsub <2 x float> %2, %12
  %14 = shufflevector <2 x float> %13, <2 x float> poison, <2 x i32> <i32 1, i32 0>
  %15 = fsub <2 x float> %4, %0
  %16 = extractelement <2 x float> %15, i64 1
  %17 = fneg float %16
  %18 = extractelement <2 x float> %13, i64 1
  %19 = fmul float %18, %17
  %20 = tail call float @llvm.fmuladd.f32(float %9, float %10, float %19)
  store float %20, ptr %6, align 4, !tbaa !5
  %21 = shufflevector <2 x float> %15, <2 x float> poison, <2 x i32> <i32 poison, i32 0>
  %22 = insertelement <2 x float> %21, float %10, i64 0
  %23 = fneg <2 x float> %22
  %24 = shufflevector <2 x float> %13, <2 x float> %8, <2 x i32> <i32 0, i32 3>
  %25 = fmul <2 x float> %24, %23
  %26 = tail call <2 x float> @llvm.fmuladd.v2f32(<2 x float> %14, <2 x float> %15, <2 x float> %25)
  store <2 x float> %26, ptr %11, align 4, !tbaa !10
  ret void
}

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

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

attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write) 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 nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = !{!"", !7, i64 0, !7, i64 4, !7, i64 8}
!7 = !{!"float", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!7, !7, i64 0}


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