; LLVM IR from sh1l0h/ZINC :: src (camera)

; 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: nounwind uwtable
define dso_local void @zinc_view_matrix(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4) #0 {
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  store ptr %0, ptr %6, align 8, !tbaa !5
  store ptr %1, ptr %7, align 8, !tbaa !5
  store ptr %2, ptr %8, align 8, !tbaa !5
  store ptr %3, ptr %9, align 8, !tbaa !5
  store ptr %4, ptr %10, align 8, !tbaa !5
  %11 = load ptr, ptr %8, align 8, !tbaa !5
  %12 = getelementptr inbounds [3 x float], ptr %11, i64 0, i64 0
  %13 = load float, ptr %12, align 4, !tbaa !9
  %14 = load ptr, ptr %6, align 8, !tbaa !5
  %15 = getelementptr inbounds [4 x float], ptr %14, i64 0
  %16 = getelementptr inbounds [4 x float], ptr %15, i64 0, i64 0
  store float %13, ptr %16, align 4, !tbaa !10
  %17 = load ptr, ptr %8, align 8, !tbaa !5
  %18 = getelementptr inbounds [3 x float], ptr %17, i64 0, i64 1
  %19 = load float, ptr %18, align 4, !tbaa !9
  %20 = load ptr, ptr %6, align 8, !tbaa !5
  %21 = getelementptr inbounds [4 x float], ptr %20, i64 0
  %22 = getelementptr inbounds [4 x float], ptr %21, i64 0, i64 1
  store float %19, ptr %22, align 4, !tbaa !10
  %23 = load ptr, ptr %8, align 8, !tbaa !5
  %24 = getelementptr inbounds [3 x float], ptr %23, i64 0, i64 2
  %25 = load float, ptr %24, align 4, !tbaa !9
  %26 = load ptr, ptr %6, align 8, !tbaa !5
  %27 = getelementptr inbounds [4 x float], ptr %26, i64 0
  %28 = getelementptr inbounds [4 x float], ptr %27, i64 0, i64 2
  store float %25, ptr %28, align 4, !tbaa !10
  %29 = load ptr, ptr %7, align 8, !tbaa !5
  %30 = load ptr, ptr %8, align 8, !tbaa !5
  %31 = call float @zinc_vec3_dot(ptr noundef %29, ptr noundef %30)
  %32 = fneg float %31
  %33 = load ptr, ptr %6, align 8, !tbaa !5
  %34 = getelementptr inbounds [4 x float], ptr %33, i64 0
  %35 = getelementptr inbounds [4 x float], ptr %34, i64 0, i64 3
  store float %32, ptr %35, align 4, !tbaa !10
  %36 = load ptr, ptr %9, align 8, !tbaa !5
  %37 = getelementptr inbounds [3 x float], ptr %36, i64 0, i64 0
  %38 = load float, ptr %37, align 4, !tbaa !9
  %39 = load ptr, ptr %6, align 8, !tbaa !5
  %40 = getelementptr inbounds [4 x float], ptr %39, i64 1
  %41 = getelementptr inbounds [4 x float], ptr %40, i64 0, i64 0
  store float %38, ptr %41, align 4, !tbaa !10
  %42 = load ptr, ptr %9, align 8, !tbaa !5
  %43 = getelementptr inbounds [3 x float], ptr %42, i64 0, i64 1
  %44 = load float, ptr %43, align 4, !tbaa !9
  %45 = load ptr, ptr %6, align 8, !tbaa !5
  %46 = getelementptr inbounds [4 x float], ptr %45, i64 1
  %47 = getelementptr inbounds [4 x float], ptr %46, i64 0, i64 1
  store float %44, ptr %47, align 4, !tbaa !10
  %48 = load ptr, ptr %9, align 8, !tbaa !5
  %49 = getelementptr inbounds [3 x float], ptr %48, i64 0, i64 2
  %50 = load float, ptr %49, align 4, !tbaa !9
  %51 = load ptr, ptr %6, align 8, !tbaa !5
  %52 = getelementptr inbounds [4 x float], ptr %51, i64 1
  %53 = getelementptr inbounds [4 x float], ptr %52, i64 0, i64 2
  store float %50, ptr %53, align 4, !tbaa !10
  %54 = load ptr, ptr %7, align 8, !tbaa !5
  %55 = load ptr, ptr %9, align 8, !tbaa !5
  %56 = call float @zinc_vec3_dot(ptr noundef %54, ptr noundef %55)
  %57 = fneg float %56
  %58 = load ptr, ptr %6, align 8, !tbaa !5
  %59 = getelementptr inbounds [4 x float], ptr %58, i64 1
  %60 = getelementptr inbounds [4 x float], ptr %59, i64 0, i64 3
  store float %57, ptr %60, align 4, !tbaa !10
  %61 = load ptr, ptr %10, align 8, !tbaa !5
  %62 = getelementptr inbounds [3 x float], ptr %61, i64 0, i64 0
  %63 = load float, ptr %62, align 4, !tbaa !9
  %64 = load ptr, ptr %6, align 8, !tbaa !5
  %65 = getelementptr inbounds [4 x float], ptr %64, i64 2
  %66 = getelementptr inbounds [4 x float], ptr %65, i64 0, i64 0
  store float %63, ptr %66, align 4, !tbaa !10
  %67 = load ptr, ptr %10, align 8, !tbaa !5
  %68 = getelementptr inbounds [3 x float], ptr %67, i64 0, i64 1
  %69 = load float, ptr %68, align 4, !tbaa !9
  %70 = load ptr, ptr %6, align 8, !tbaa !5
  %71 = getelementptr inbounds [4 x float], ptr %70, i64 2
  %72 = getelementptr inbounds [4 x float], ptr %71, i64 0, i64 1
  store float %69, ptr %72, align 4, !tbaa !10
  %73 = load ptr, ptr %10, align 8, !tbaa !5
  %74 = getelementptr inbounds [3 x float], ptr %73, i64 0, i64 2
  %75 = load float, ptr %74, align 4, !tbaa !9
  %76 = load ptr, ptr %6, align 8, !tbaa !5
  %77 = getelementptr inbounds [4 x float], ptr %76, i64 2
  %78 = getelementptr inbounds [4 x float], ptr %77, i64 0, i64 2
  store float %75, ptr %78, align 4, !tbaa !10
  %79 = load ptr, ptr %7, align 8, !tbaa !5
  %80 = load ptr, ptr %10, align 8, !tbaa !5
  %81 = call float @zinc_vec3_dot(ptr noundef %79, ptr noundef %80)
  %82 = fneg float %81
  %83 = load ptr, ptr %6, align 8, !tbaa !5
  %84 = getelementptr inbounds [4 x float], ptr %83, i64 2
  %85 = getelementptr inbounds [4 x float], ptr %84, i64 0, i64 3
  store float %82, ptr %85, align 4, !tbaa !10
  %86 = load ptr, ptr %6, 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 0
  store float 0.000000e+00, ptr %88, align 4, !tbaa !10
  %89 = load ptr, ptr %6, align 8, !tbaa !5
  %90 = getelementptr inbounds [4 x float], ptr %89, i64 3
  %91 = getelementptr inbounds [4 x float], ptr %90, i64 0, i64 1
  store float 0.000000e+00, ptr %91, align 4, !tbaa !10
  %92 = load ptr, ptr %6, align 8, !tbaa !5
  %93 = getelementptr inbounds [4 x float], ptr %92, i64 3
  %94 = getelementptr inbounds [4 x float], ptr %93, i64 0, i64 2
  store float 0.000000e+00, ptr %94, align 4, !tbaa !10
  %95 = load ptr, ptr %6, align 8, !tbaa !5
  %96 = getelementptr inbounds [4 x float], ptr %95, i64 3
  %97 = getelementptr inbounds [4 x float], ptr %96, i64 0, i64 3
  store float 1.000000e+00, ptr %97, align 4, !tbaa !10
  ret void
}

declare float @zinc_vec3_dot(ptr noundef, ptr noundef) #1

attributes #0 = { 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 = { "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/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"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: nounwind uwtable
define dso_local void @zinc_view_matrix(ptr nocapture noundef writeonly %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4) local_unnamed_addr #0 {
  %6 = load float, ptr %2, align 4, !tbaa !5
  store float %6, ptr %0, align 4, !tbaa !8
  %7 = getelementptr inbounds i8, ptr %2, i64 4
  %8 = load float, ptr %7, align 4, !tbaa !5
  %9 = getelementptr inbounds i8, ptr %0, i64 4
  store float %8, ptr %9, align 4, !tbaa !8
  %10 = getelementptr inbounds i8, ptr %2, i64 8
  %11 = load float, ptr %10, align 4, !tbaa !5
  %12 = getelementptr inbounds i8, ptr %0, i64 8
  store float %11, ptr %12, align 4, !tbaa !8
  %13 = tail call float @zinc_vec3_dot(ptr noundef %1, ptr noundef nonnull %2) #2
  %14 = fneg float %13
  %15 = getelementptr inbounds i8, ptr %0, i64 12
  store float %14, ptr %15, align 4, !tbaa !8
  %16 = load float, ptr %3, align 4, !tbaa !5
  %17 = getelementptr inbounds i8, ptr %0, i64 16
  store float %16, ptr %17, align 4, !tbaa !8
  %18 = getelementptr inbounds i8, ptr %3, i64 4
  %19 = load float, ptr %18, align 4, !tbaa !5
  %20 = getelementptr inbounds i8, ptr %0, i64 20
  store float %19, ptr %20, align 4, !tbaa !8
  %21 = getelementptr inbounds i8, ptr %3, i64 8
  %22 = load float, ptr %21, align 4, !tbaa !5
  %23 = getelementptr inbounds i8, ptr %0, i64 24
  store float %22, ptr %23, align 4, !tbaa !8
  %24 = tail call float @zinc_vec3_dot(ptr noundef %1, ptr noundef nonnull %3) #2
  %25 = fneg float %24
  %26 = getelementptr inbounds i8, ptr %0, i64 28
  store float %25, ptr %26, align 4, !tbaa !8
  %27 = load float, ptr %4, align 4, !tbaa !5
  %28 = getelementptr inbounds i8, ptr %0, i64 32
  store float %27, ptr %28, align 4, !tbaa !8
  %29 = getelementptr inbounds i8, ptr %4, i64 4
  %30 = load float, ptr %29, align 4, !tbaa !5
  %31 = getelementptr inbounds i8, ptr %0, i64 36
  store float %30, ptr %31, align 4, !tbaa !8
  %32 = getelementptr inbounds i8, ptr %4, i64 8
  %33 = load float, ptr %32, align 4, !tbaa !5
  %34 = getelementptr inbounds i8, ptr %0, i64 40
  store float %33, ptr %34, align 4, !tbaa !8
  %35 = tail call float @zinc_vec3_dot(ptr noundef %1, ptr noundef nonnull %4) #2
  %36 = fneg float %35
  %37 = getelementptr inbounds i8, ptr %0, i64 44
  store float %36, ptr %37, align 4, !tbaa !8
  %38 = getelementptr inbounds i8, ptr %0, i64 48
  store <4 x float> <float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 1.000000e+00>, ptr %38, align 4, !tbaa !8
  ret void
}

declare float @zinc_vec3_dot(ptr noundef, ptr noundef) local_unnamed_addr #1

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


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