; LLVM IR from erwincoumans/tiny-differentiable-simulator :: src/visualizer/opengl/tiny_camera.ll (ZNK10TinyCamera28get_camera_projection_matrixEPf)

; 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.TinyCamera = type { ptr, ptr }
%struct.TinyCameraInternalData = type { %"struct.TINY::TinyVector3", float, %"struct.TINY::TinyVector3", %"struct.TINY::TinyVector3", i32, %"struct.TINY::TinyVector3", float, float, float, float, float, [16 x float], [16 x float] }
%"struct.TINY::TinyVector3" = type { float, float, float, i32 }

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK10TinyCamera28get_camera_projection_matrixEPf(ptr noundef nonnull align 8 dereferenceable(16) %0, ptr noundef %1) unnamed_addr #0 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %5 = load ptr, ptr %3, align 8
  %6 = getelementptr inbounds %struct.TinyCamera, ptr %5, i32 0, i32 1
  %7 = load ptr, ptr %6, align 8, !tbaa !9
  %8 = getelementptr inbounds %struct.TinyCameraInternalData, ptr %7, i32 0, i32 8
  %9 = load float, ptr %8, align 4, !tbaa !11
  %10 = fneg float %9
  %11 = getelementptr inbounds %struct.TinyCamera, ptr %5, i32 0, i32 1
  %12 = load ptr, ptr %11, align 8, !tbaa !9
  %13 = getelementptr inbounds %struct.TinyCameraInternalData, ptr %12, i32 0, i32 9
  %14 = load float, ptr %13, align 4, !tbaa !16
  %15 = fmul float %10, %14
  %16 = getelementptr inbounds %struct.TinyCamera, ptr %5, i32 0, i32 1
  %17 = load ptr, ptr %16, align 8, !tbaa !9
  %18 = getelementptr inbounds %struct.TinyCameraInternalData, ptr %17, i32 0, i32 8
  %19 = load float, ptr %18, align 4, !tbaa !11
  %20 = getelementptr inbounds %struct.TinyCamera, ptr %5, i32 0, i32 1
  %21 = load ptr, ptr %20, align 8, !tbaa !9
  %22 = getelementptr inbounds %struct.TinyCameraInternalData, ptr %21, i32 0, i32 9
  %23 = load float, ptr %22, align 4, !tbaa !16
  %24 = fmul float %19, %23
  %25 = getelementptr inbounds %struct.TinyCamera, ptr %5, i32 0, i32 1
  %26 = load ptr, ptr %25, align 8, !tbaa !9
  %27 = getelementptr inbounds %struct.TinyCameraInternalData, ptr %26, i32 0, i32 9
  %28 = load float, ptr %27, align 4, !tbaa !16
  %29 = fneg float %28
  %30 = getelementptr inbounds %struct.TinyCamera, ptr %5, i32 0, i32 1
  %31 = load ptr, ptr %30, align 8, !tbaa !9
  %32 = getelementptr inbounds %struct.TinyCameraInternalData, ptr %31, i32 0, i32 9
  %33 = load float, ptr %32, align 4, !tbaa !16
  %34 = getelementptr inbounds %struct.TinyCamera, ptr %5, i32 0, i32 1
  %35 = load ptr, ptr %34, align 8, !tbaa !9
  %36 = getelementptr inbounds %struct.TinyCameraInternalData, ptr %35, i32 0, i32 9
  %37 = load float, ptr %36, align 4, !tbaa !16
  %38 = getelementptr inbounds %struct.TinyCamera, ptr %5, i32 0, i32 1
  %39 = load ptr, ptr %38, align 8, !tbaa !9
  %40 = getelementptr inbounds %struct.TinyCameraInternalData, ptr %39, i32 0, i32 10
  %41 = load float, ptr %40, align 4, !tbaa !17
  %42 = load ptr, ptr %4, align 8, !tbaa !5
  call void @_ZL15b3CreateFrustumffffffPf(float noundef %15, float noundef %24, float noundef %29, float noundef %33, float noundef %37, float noundef %41, ptr noundef %42)
  ret void
}

; Function Attrs: mustprogress nounwind uwtable
declare hidden void @_ZL15b3CreateFrustumffffffPf(float noundef, float noundef, float noundef, float noundef, float noundef, float noundef, ptr noundef) #1

attributes #0 = { 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 #1 = { 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" }

!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, !6, i64 8}
!10 = !{!"_ZTS10TinyCamera", !6, i64 8}
!11 = !{!12, !14, i64 80}
!12 = !{!"_ZTS22TinyCameraInternalData", !13, i64 0, !14, i64 16, !13, i64 20, !13, i64 36, !15, i64 52, !13, i64 56, !14, i64 72, !14, i64 76, !14, i64 80, !14, i64 84, !14, i64 88, !7, i64 92, !7, i64 156}
!13 = !{!"_ZTSN4TINY11TinyVector3IfNS_10FloatUtilsEEE", !14, i64 0, !14, i64 4, !14, i64 8, !15, i64 12}
!14 = !{!"float", !7, i64 0}
!15 = !{!"int", !7, i64 0}
!16 = !{!12, !14, i64 84}
!17 = !{!12, !14, i64 88}


; 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 nounwind uwtable
define dso_local void @_ZNK10TinyCamera28get_camera_projection_matrixEPf(ptr nocapture noundef nonnull readonly align 8 dereferenceable(16) %0, ptr noundef %1) unnamed_addr #0 align 2 {
  %3 = getelementptr inbounds i8, ptr %0, i64 8
  %4 = load ptr, ptr %3, align 8, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %4, i64 80
  %6 = load float, ptr %5, align 4, !tbaa !10
  %7 = fneg float %6
  %8 = getelementptr inbounds i8, ptr %4, i64 84
  %9 = load float, ptr %8, align 4, !tbaa !15
  %10 = fmul float %9, %7
  %11 = fmul float %6, %9
  %12 = fneg float %9
  %13 = getelementptr inbounds i8, ptr %4, i64 88
  %14 = load float, ptr %13, align 4, !tbaa !16
  tail call void @_ZL15b3CreateFrustumffffffPf(float noundef %10, float noundef %11, float noundef %12, float noundef %9, float noundef %9, float noundef %14, ptr noundef %1)
  ret void
}

; Function Attrs: mustprogress nounwind uwtable
declare hidden void @_ZL15b3CreateFrustumffffffPf(float noundef, float noundef, float noundef, float noundef, float noundef, float noundef, ptr noundef) local_unnamed_addr #0

attributes #0 = { 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" }

!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 8}
!6 = !{!"_ZTS10TinyCamera", !7, i64 8}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!11, !13, i64 80}
!11 = !{!"_ZTS22TinyCameraInternalData", !12, i64 0, !13, i64 16, !12, i64 20, !12, i64 36, !14, i64 52, !12, i64 56, !13, i64 72, !13, i64 76, !13, i64 80, !13, i64 84, !13, i64 88, !8, i64 92, !8, i64 156}
!12 = !{!"_ZTSN4TINY11TinyVector3IfNS_10FloatUtilsEEE", !13, i64 0, !13, i64 4, !13, i64 8, !14, i64 12}
!13 = !{!"float", !8, i64 0}
!14 = !{!"int", !8, i64 0}
!15 = !{!11, !13, i64 84}
!16 = !{!11, !13, i64 88}


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