; LLVM IR from Angelo1211/HybridRenderingEngine :: src/geometry.ll (ZN7Frustum15setCamInternalsEv)

; 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.Frustum = type { [6 x %struct.Plane], float, float, float, float, float, float }
%struct.Plane = type { %"struct.glm::vec", float }
%"struct.glm::vec" = type { %union.anon }
%union.anon = type { %struct.anon }
%struct.anon = 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: mustprogress uwtable
define dso_local void @_ZN7Frustum15setCamInternalsEv(ptr noundef nonnull align 4 dereferenceable(120) %0) #1 align 2 {
  %2 = alloca ptr, align 8
  %3 = alloca float, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  %4 = load ptr, ptr %2, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #3
  %5 = getelementptr inbounds %struct.Frustum, ptr %4, i32 0, i32 1
  %6 = load float, ptr %5, align 4, !tbaa !9
  %7 = fdiv float %6, 2.000000e+00
  %8 = call noundef float @_ZN3glm7radiansIfEET_S1_(float noundef %7)
  %9 = call noundef float @_ZSt3tanf(float noundef %8)
  store float %9, ptr %3, align 4, !tbaa !12
  %10 = getelementptr inbounds %struct.Frustum, ptr %4, i32 0, i32 2
  %11 = load float, ptr %10, align 4, !tbaa !13
  %12 = load float, ptr %3, align 4, !tbaa !12
  %13 = fmul float %11, %12
  %14 = getelementptr inbounds %struct.Frustum, ptr %4, i32 0, i32 5
  store float %13, ptr %14, align 4, !tbaa !14
  %15 = getelementptr inbounds %struct.Frustum, ptr %4, i32 0, i32 5
  %16 = load float, ptr %15, align 4, !tbaa !14
  %17 = getelementptr inbounds %struct.Frustum, ptr %4, i32 0, i32 4
  %18 = load float, ptr %17, align 4, !tbaa !15
  %19 = fmul float %16, %18
  %20 = getelementptr inbounds %struct.Frustum, ptr %4, i32 0, i32 6
  store float %19, ptr %20, align 4, !tbaa !16
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #3
  ret void
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef float @_ZSt3tanf(float noundef) #2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef float @_ZN3glm7radiansIfEET_S1_(float 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, !11, i64 96}
!10 = !{!"_ZTS7Frustum", !7, i64 0, !11, i64 96, !11, i64 100, !11, i64 104, !11, i64 108, !11, i64 112, !11, i64 116}
!11 = !{!"float", !7, i64 0}
!12 = !{!11, !11, i64 0}
!13 = !{!10, !11, i64 100}
!14 = !{!10, !11, i64 112}
!15 = !{!10, !11, i64 108}
!16 = !{!10, !11, i64 116}


; 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 @_ZN7Frustum15setCamInternalsEv(ptr nocapture noundef nonnull align 4 dereferenceable(120) %0) local_unnamed_addr #0 align 2 {
  %2 = getelementptr inbounds i8, ptr %0, i64 96
  %3 = load float, ptr %2, align 4, !tbaa !5
  %4 = fmul float %3, 5.000000e-01
  %5 = tail call noundef float @_ZN3glm7radiansIfEET_S1_(float noundef %4)
  %6 = tail call noundef float @_ZSt3tanf(float noundef %5)
  %7 = getelementptr inbounds i8, ptr %0, i64 100
  %8 = load float, ptr %7, align 4, !tbaa !10
  %9 = fmul float %6, %8
  %10 = getelementptr inbounds i8, ptr %0, i64 112
  store float %9, ptr %10, align 4, !tbaa !11
  %11 = getelementptr inbounds i8, ptr %0, i64 108
  %12 = load float, ptr %11, align 4, !tbaa !12
  %13 = fmul float %9, %12
  %14 = getelementptr inbounds i8, ptr %0, i64 116
  store float %13, ptr %14, align 4, !tbaa !13
  ret void
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef float @_ZSt3tanf(float noundef) local_unnamed_addr #1

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef float @_ZN3glm7radiansIfEET_S1_(float noundef) local_unnamed_addr #1

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

!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, !9, i64 96}
!6 = !{!"_ZTS7Frustum", !7, i64 0, !9, i64 96, !9, i64 100, !9, i64 104, !9, i64 108, !9, i64 112, !9, i64 116}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!"float", !7, i64 0}
!10 = !{!6, !9, i64 100}
!11 = !{!6, !9, i64 112}
!12 = !{!6, !9, i64 108}
!13 = !{!6, !9, i64 116}


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