; LLVM IR from mateeeeeee/Adria-DX11 :: ThirdParty/tinygltf/examples/common/matrix.ll (ZN6Matrix6LookAtEPA4_fPfS2_S2_)

; 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"

; 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
define dso_local void @_ZN6Matrix6LookAtEPA4_fPfS2_S2_(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3) #1 align 2 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca [3 x float], align 4
  %10 = alloca [3 x float], align 4
  %11 = alloca [3 x float], align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store ptr %2, ptr %7, align 8, !tbaa !5
  store ptr %3, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 12, ptr %9) #3
  call void @llvm.lifetime.start.p0(i64 12, ptr %10) #3
  call void @llvm.lifetime.start.p0(i64 12, ptr %11) #3
  %12 = load ptr, ptr %7, align 8, !tbaa !5
  %13 = getelementptr inbounds float, ptr %12, i64 0
  %14 = load float, ptr %13, align 4, !tbaa !9
  %15 = load ptr, ptr %6, align 8, !tbaa !5
  %16 = getelementptr inbounds float, ptr %15, i64 0
  %17 = load float, ptr %16, align 4, !tbaa !9
  %18 = fsub float %14, %17
  %19 = getelementptr inbounds [3 x float], ptr %11, i64 0, i64 0
  store float %18, ptr %19, align 4, !tbaa !9
  %20 = load ptr, ptr %7, align 8, !tbaa !5
  %21 = getelementptr inbounds float, ptr %20, i64 1
  %22 = load float, ptr %21, align 4, !tbaa !9
  %23 = load ptr, ptr %6, align 8, !tbaa !5
  %24 = getelementptr inbounds float, ptr %23, i64 1
  %25 = load float, ptr %24, align 4, !tbaa !9
  %26 = fsub float %22, %25
  %27 = getelementptr inbounds [3 x float], ptr %11, i64 0, i64 1
  store float %26, ptr %27, align 4, !tbaa !9
  %28 = load ptr, ptr %7, align 8, !tbaa !5
  %29 = getelementptr inbounds float, ptr %28, i64 2
  %30 = load float, ptr %29, align 4, !tbaa !9
  %31 = load ptr, ptr %6, align 8, !tbaa !5
  %32 = getelementptr inbounds float, ptr %31, i64 2
  %33 = load float, ptr %32, align 4, !tbaa !9
  %34 = fsub float %30, %33
  %35 = getelementptr inbounds [3 x float], ptr %11, i64 0, i64 2
  store float %34, ptr %35, align 4, !tbaa !9
  %36 = getelementptr inbounds [3 x float], ptr %11, i64 0, i64 0
  call void @_ZL10vnormalizePf(ptr noundef %36)
  %37 = getelementptr inbounds [3 x float], ptr %9, i64 0, i64 0
  %38 = getelementptr inbounds [3 x float], ptr %11, i64 0, i64 0
  %39 = load ptr, ptr %8, align 8, !tbaa !5
  call void @_ZL6vcrossPfS_S_(ptr noundef %37, ptr noundef %38, ptr noundef %39)
  %40 = getelementptr inbounds [3 x float], ptr %9, i64 0, i64 0
  call void @_ZL10vnormalizePf(ptr noundef %40)
  %41 = getelementptr inbounds [3 x float], ptr %10, i64 0, i64 0
  %42 = getelementptr inbounds [3 x float], ptr %9, i64 0, i64 0
  %43 = getelementptr inbounds [3 x float], ptr %11, i64 0, i64 0
  call void @_ZL6vcrossPfS_S_(ptr noundef %41, ptr noundef %42, ptr noundef %43)
  %44 = getelementptr inbounds [3 x float], ptr %10, i64 0, i64 0
  call void @_ZL10vnormalizePf(ptr noundef %44)
  %45 = getelementptr inbounds [3 x float], ptr %9, i64 0, i64 0
  %46 = load float, ptr %45, align 4, !tbaa !9
  %47 = load ptr, ptr %5, align 8, !tbaa !5
  %48 = getelementptr inbounds [4 x float], ptr %47, i64 0
  %49 = getelementptr inbounds [4 x float], ptr %48, i64 0, i64 0
  store float %46, ptr %49, align 4, !tbaa !9
  %50 = getelementptr inbounds [3 x float], ptr %10, i64 0, i64 0
  %51 = load float, ptr %50, align 4, !tbaa !9
  %52 = load ptr, ptr %5, align 8, !tbaa !5
  %53 = getelementptr inbounds [4 x float], ptr %52, i64 1
  %54 = getelementptr inbounds [4 x float], ptr %53, i64 0, i64 0
  store float %51, ptr %54, align 4, !tbaa !9
  %55 = getelementptr inbounds [3 x float], ptr %11, i64 0, i64 0
  %56 = load float, ptr %55, align 4, !tbaa !9
  %57 = fneg float %56
  %58 = load ptr, ptr %5, align 8, !tbaa !5
  %59 = getelementptr inbounds [4 x float], ptr %58, i64 2
  %60 = getelementptr inbounds [4 x float], ptr %59, i64 0, i64 0
  store float %57, ptr %60, align 4, !tbaa !9
  %61 = load ptr, ptr %6, align 8, !tbaa !5
  %62 = getelementptr inbounds float, ptr %61, i64 0
  %63 = load float, ptr %62, align 4, !tbaa !9
  %64 = load ptr, ptr %5, align 8, !tbaa !5
  %65 = getelementptr inbounds [4 x float], ptr %64, i64 3
  %66 = getelementptr inbounds [4 x float], ptr %65, i64 0, i64 0
  store float %63, ptr %66, align 4, !tbaa !9
  %67 = getelementptr inbounds [3 x float], ptr %9, i64 0, i64 1
  %68 = load float, ptr %67, align 4, !tbaa !9
  %69 = load ptr, ptr %5, align 8, !tbaa !5
  %70 = getelementptr inbounds [4 x float], ptr %69, i64 0
  %71 = getelementptr inbounds [4 x float], ptr %70, i64 0, i64 1
  store float %68, ptr %71, align 4, !tbaa !9
  %72 = getelementptr inbounds [3 x float], ptr %10, i64 0, i64 1
  %73 = load float, ptr %72, align 4, !tbaa !9
  %74 = load ptr, ptr %5, align 8, !tbaa !5
  %75 = getelementptr inbounds [4 x float], ptr %74, i64 1
  %76 = getelementptr inbounds [4 x float], ptr %75, i64 0, i64 1
  store float %73, ptr %76, align 4, !tbaa !9
  %77 = getelementptr inbounds [3 x float], ptr %11, i64 0, i64 1
  %78 = load float, ptr %77, align 4, !tbaa !9
  %79 = fneg float %78
  %80 = load ptr, ptr %5, align 8, !tbaa !5
  %81 = getelementptr inbounds [4 x float], ptr %80, i64 2
  %82 = getelementptr inbounds [4 x float], ptr %81, i64 0, i64 1
  store float %79, ptr %82, align 4, !tbaa !9
  %83 = load ptr, ptr %6, align 8, !tbaa !5
  %84 = getelementptr inbounds float, ptr %83, i64 1
  %85 = load float, ptr %84, align 4, !tbaa !9
  %86 = load ptr, ptr %5, align 8, !tbaa !5
  %87 = getelementptr inbounds [4 x float], ptr %86, i64 3
  %88 = getelementptr inbounds [4 x float], ptr %87, i64 0, i64 1
  store float %85, ptr %88, align 4, !tbaa !9
  %89 = getelementptr inbounds [3 x float], ptr %9, i64 0, i64 2
  %90 = load float, ptr %89, align 4, !tbaa !9
  %91 = load ptr, ptr %5, align 8, !tbaa !5
  %92 = getelementptr inbounds [4 x float], ptr %91, i64 0
  %93 = getelementptr inbounds [4 x float], ptr %92, i64 0, i64 2
  store float %90, ptr %93, align 4, !tbaa !9
  %94 = getelementptr inbounds [3 x float], ptr %10, i64 0, i64 2
  %95 = load float, ptr %94, align 4, !tbaa !9
  %96 = load ptr, ptr %5, align 8, !tbaa !5
  %97 = getelementptr inbounds [4 x float], ptr %96, i64 1
  %98 = getelementptr inbounds [4 x float], ptr %97, i64 0, i64 2
  store float %95, ptr %98, align 4, !tbaa !9
  %99 = getelementptr inbounds [3 x float], ptr %11, i64 0, i64 2
  %100 = load float, ptr %99, align 4, !tbaa !9
  %101 = fneg float %100
  %102 = load ptr, ptr %5, align 8, !tbaa !5
  %103 = getelementptr inbounds [4 x float], ptr %102, i64 2
  %104 = getelementptr inbounds [4 x float], ptr %103, i64 0, i64 2
  store float %101, ptr %104, align 4, !tbaa !9
  %105 = load ptr, ptr %6, align 8, !tbaa !5
  %106 = getelementptr inbounds float, ptr %105, i64 2
  %107 = load float, ptr %106, align 4, !tbaa !9
  %108 = load ptr, ptr %5, align 8, !tbaa !5
  %109 = getelementptr inbounds [4 x float], ptr %108, i64 3
  %110 = getelementptr inbounds [4 x float], ptr %109, i64 0, i64 2
  store float %107, ptr %110, align 4, !tbaa !9
  %111 = load ptr, ptr %5, align 8, !tbaa !5
  %112 = getelementptr inbounds [4 x float], ptr %111, i64 0
  %113 = getelementptr inbounds [4 x float], ptr %112, i64 0, i64 3
  store float 0.000000e+00, ptr %113, align 4, !tbaa !9
  %114 = load ptr, ptr %5, align 8, !tbaa !5
  %115 = getelementptr inbounds [4 x float], ptr %114, i64 1
  %116 = getelementptr inbounds [4 x float], ptr %115, i64 0, i64 3
  store float 0.000000e+00, ptr %116, align 4, !tbaa !9
  %117 = load ptr, ptr %5, align 8, !tbaa !5
  %118 = getelementptr inbounds [4 x float], ptr %117, i64 2
  %119 = getelementptr inbounds [4 x float], ptr %118, i64 0, i64 3
  store float 0.000000e+00, ptr %119, align 4, !tbaa !9
  %120 = load ptr, ptr %5, align 8, !tbaa !5
  %121 = getelementptr inbounds [4 x float], ptr %120, i64 3
  %122 = getelementptr inbounds [4 x float], ptr %121, i64 0, i64 3
  store float 1.000000e+00, ptr %122, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 12, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 12, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 12, ptr %9) #3
  ret void
}

; Function Attrs: mustprogress uwtable
declare hidden void @_ZL10vnormalizePf(ptr noundef) #1

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden void @_ZL6vcrossPfS_S_(ptr noundef, ptr noundef, ptr noundef) #2

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 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 #3 = { 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}


; 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
define dso_local void @_ZN6Matrix6LookAtEPA4_fPfS2_S2_(ptr nocapture noundef writeonly %0, ptr nocapture noundef readonly %1, ptr nocapture noundef readonly %2, ptr noundef %3) local_unnamed_addr #1 align 2 {
  %5 = alloca [3 x float], align 4
  %6 = alloca [3 x float], align 4
  %7 = alloca [3 x float], align 8
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %5) #3
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %6) #3
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %7) #3
  %8 = getelementptr inbounds i8, ptr %1, i64 4
  %9 = getelementptr inbounds i8, ptr %7, i64 4
  %10 = load <2 x float>, ptr %2, align 4, !tbaa !5
  %11 = load <2 x float>, ptr %1, align 4, !tbaa !5
  %12 = fsub <2 x float> %10, %11
  store <2 x float> %12, ptr %7, align 8, !tbaa !5
  %13 = getelementptr inbounds i8, ptr %2, i64 8
  %14 = load float, ptr %13, align 4, !tbaa !5
  %15 = getelementptr inbounds i8, ptr %1, i64 8
  %16 = load float, ptr %15, align 4, !tbaa !5
  %17 = fsub float %14, %16
  %18 = getelementptr inbounds i8, ptr %7, i64 8
  store float %17, ptr %18, align 8, !tbaa !5
  call void @_ZL10vnormalizePf(ptr noundef nonnull %7)
  call void @_ZL6vcrossPfS_S_(ptr noundef nonnull %5, ptr noundef nonnull %7, ptr noundef %3)
  call void @_ZL10vnormalizePf(ptr noundef nonnull %5)
  call void @_ZL6vcrossPfS_S_(ptr noundef nonnull %6, ptr noundef nonnull %5, ptr noundef nonnull %7)
  call void @_ZL10vnormalizePf(ptr noundef nonnull %6)
  %19 = load float, ptr %5, align 4, !tbaa !5
  store float %19, ptr %0, align 4, !tbaa !5
  %20 = load float, ptr %6, align 4, !tbaa !5
  %21 = getelementptr inbounds i8, ptr %0, i64 16
  store float %20, ptr %21, align 4, !tbaa !5
  %22 = load float, ptr %7, align 8, !tbaa !5
  %23 = fneg float %22
  %24 = getelementptr inbounds i8, ptr %0, i64 32
  store float %23, ptr %24, align 4, !tbaa !5
  %25 = load float, ptr %1, align 4, !tbaa !5
  %26 = getelementptr inbounds i8, ptr %0, i64 48
  store float %25, ptr %26, align 4, !tbaa !5
  %27 = getelementptr inbounds i8, ptr %5, i64 4
  %28 = load float, ptr %27, align 4, !tbaa !5
  %29 = getelementptr inbounds i8, ptr %0, i64 4
  store float %28, ptr %29, align 4, !tbaa !5
  %30 = getelementptr inbounds i8, ptr %6, i64 4
  %31 = load float, ptr %30, align 4, !tbaa !5
  %32 = getelementptr inbounds i8, ptr %0, i64 20
  store float %31, ptr %32, align 4, !tbaa !5
  %33 = load float, ptr %9, align 4, !tbaa !5
  %34 = fneg float %33
  %35 = getelementptr inbounds i8, ptr %0, i64 36
  store float %34, ptr %35, align 4, !tbaa !5
  %36 = load float, ptr %8, align 4, !tbaa !5
  %37 = getelementptr inbounds i8, ptr %0, i64 52
  store float %36, ptr %37, align 4, !tbaa !5
  %38 = getelementptr inbounds i8, ptr %5, i64 8
  %39 = load float, ptr %38, align 4, !tbaa !5
  %40 = getelementptr inbounds i8, ptr %0, i64 8
  store float %39, ptr %40, align 4, !tbaa !5
  %41 = getelementptr inbounds i8, ptr %6, i64 8
  %42 = load float, ptr %41, align 4, !tbaa !5
  %43 = getelementptr inbounds i8, ptr %0, i64 24
  store float %42, ptr %43, align 4, !tbaa !5
  %44 = load float, ptr %18, align 8, !tbaa !5
  %45 = fneg float %44
  %46 = getelementptr inbounds i8, ptr %0, i64 40
  store float %45, ptr %46, align 4, !tbaa !5
  %47 = load float, ptr %15, align 4, !tbaa !5
  %48 = getelementptr inbounds i8, ptr %0, i64 56
  store float %47, ptr %48, align 4, !tbaa !5
  %49 = getelementptr inbounds i8, ptr %0, i64 12
  store float 0.000000e+00, ptr %49, align 4, !tbaa !5
  %50 = getelementptr inbounds i8, ptr %0, i64 28
  store float 0.000000e+00, ptr %50, align 4, !tbaa !5
  %51 = getelementptr inbounds i8, ptr %0, i64 44
  store float 0.000000e+00, ptr %51, align 4, !tbaa !5
  %52 = getelementptr inbounds i8, ptr %0, i64 60
  store float 1.000000e+00, ptr %52, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %7) #3
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %6) #3
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %5) #3
  ret void
}

; Function Attrs: mustprogress uwtable
declare hidden void @_ZL10vnormalizePf(ptr noundef) local_unnamed_addr #1

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden void @_ZL6vcrossPfS_S_(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

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 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 #3 = { 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,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,SLPVectorizerPass,SROAPass