; LLVM IR from JawherBenjeddou/GraphicsRenderer :: Graphics/src (SceneCamera)

; 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.glm::vec.2" = type { %union.anon.3, %union.anon.4 }
%union.anon.3 = type { float }
%union.anon.4 = type { float }
%"struct.glm::vec" = type { %union.anon, %union.anon.0, %union.anon.1 }
%union.anon = type { float }
%union.anon.0 = type { float }
%union.anon.1 = type { float }
%class.SceneCamera = type { %"struct.glm::vec", %"struct.glm::vec", %"struct.glm::vec", float, %"struct.glm::vec.2", 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 nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #1

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN11SceneCamera13MouseRotationERKN3glm3vecILi2EfLNS0_9qualifierE0EEE(ptr noundef nonnull align 4 dereferenceable(60) %0, ptr noundef nonnull align 4 dereferenceable(8) %1) #3 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca %"struct.glm::vec.2", align 4
  %6 = alloca %"struct.glm::vec", align 4
  %7 = alloca %"struct.glm::vec", align 4
  %8 = alloca { <2 x float>, float }, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %9 = load ptr, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #6
  %10 = load ptr, ptr %4, align 8, !tbaa !5
  %11 = getelementptr inbounds %class.SceneCamera, ptr %9, i32 0, i32 4
  %12 = call <2 x float> @_ZN3glmmiIfLNS_9qualifierE0EEENS_3vecILi2ET_XT0_EEERKS4_S6_(ptr noundef nonnull align 4 dereferenceable(8) %10, ptr noundef nonnull align 4 dereferenceable(8) %11)
  store <2 x float> %12, ptr %5, align 4
  %13 = load ptr, ptr %4, align 8, !tbaa !5
  %14 = getelementptr inbounds %class.SceneCamera, ptr %9, i32 0, i32 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %14, ptr align 4 %13, i64 8, i1 false), !tbaa.struct !9
  %15 = getelementptr inbounds %class.SceneCamera, ptr %9, i32 0, i32 3
  %16 = load float, ptr %15, align 4, !tbaa !11
  %17 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZN3glm3vecILi2EfLNS_9qualifierE0EEmLIfEERS2_T_(ptr noundef nonnull align 4 dereferenceable(8) %5, float noundef %16)
  %18 = getelementptr inbounds %"struct.glm::vec.2", ptr %5, i32 0, i32 0
  %19 = load float, ptr %18, align 4, !tbaa !10
  %20 = getelementptr inbounds %class.SceneCamera, ptr %9, i32 0, i32 5
  %21 = load float, ptr %20, align 4, !tbaa !16
  %22 = fadd float %21, %19
  store float %22, ptr %20, align 4, !tbaa !16
  %23 = getelementptr inbounds %"struct.glm::vec.2", ptr %5, i32 0, i32 1
  %24 = load float, ptr %23, align 4, !tbaa !10
  %25 = getelementptr inbounds %class.SceneCamera, ptr %9, i32 0, i32 6
  %26 = load float, ptr %25, align 4, !tbaa !17
  %27 = fsub float %26, %24
  store float %27, ptr %25, align 4, !tbaa !17
  %28 = getelementptr inbounds %class.SceneCamera, ptr %9, i32 0, i32 6
  %29 = load float, ptr %28, align 4, !tbaa !17
  %30 = fcmp ogt float %29, 8.900000e+01
  br i1 %30, label %31, label %33

31:                                               ; preds = %2
  %32 = getelementptr inbounds %class.SceneCamera, ptr %9, i32 0, i32 6
  store float 8.900000e+01, ptr %32, align 4, !tbaa !17
  br label %33

33:                                               ; preds = %31, %2
  %34 = getelementptr inbounds %class.SceneCamera, ptr %9, i32 0, i32 6
  %35 = load float, ptr %34, align 4, !tbaa !17
  %36 = fcmp olt float %35, -8.900000e+01
  br i1 %36, label %37, label %39

37:                                               ; preds = %33
  %38 = getelementptr inbounds %class.SceneCamera, ptr %9, i32 0, i32 6
  store float -8.900000e+01, ptr %38, align 4, !tbaa !17
  br label %39

39:                                               ; preds = %37, %33
  call void @llvm.lifetime.start.p0(i64 12, ptr %6) #6
  %40 = getelementptr inbounds %class.SceneCamera, ptr %9, i32 0, i32 5
  %41 = load float, ptr %40, align 4, !tbaa !16
  %42 = call noundef float @_ZN3glm7radiansIfEET_S1_(float noundef %41)
  %43 = fpext float %42 to double
  %44 = call double @cos(double noundef %43) #6
  %45 = getelementptr inbounds %class.SceneCamera, ptr %9, i32 0, i32 6
  %46 = load float, ptr %45, align 4, !tbaa !17
  %47 = call noundef float @_ZN3glm7radiansIfEET_S1_(float noundef %46)
  %48 = fpext float %47 to double
  %49 = call double @cos(double noundef %48) #6
  %50 = fmul double %44, %49
  %51 = fptrunc double %50 to float
  %52 = getelementptr inbounds %"struct.glm::vec", ptr %6, i32 0, i32 0
  store float %51, ptr %52, align 4, !tbaa !10
  %53 = getelementptr inbounds %class.SceneCamera, ptr %9, i32 0, i32 6
  %54 = load float, ptr %53, align 4, !tbaa !17
  %55 = call noundef float @_ZN3glm7radiansIfEET_S1_(float noundef %54)
  %56 = fpext float %55 to double
  %57 = call double @sin(double noundef %56) #6
  %58 = fptrunc double %57 to float
  %59 = getelementptr inbounds %"struct.glm::vec", ptr %6, i32 0, i32 1
  store float %58, ptr %59, align 4, !tbaa !10
  %60 = getelementptr inbounds %class.SceneCamera, ptr %9, i32 0, i32 5
  %61 = load float, ptr %60, align 4, !tbaa !16
  %62 = call noundef float @_ZN3glm7radiansIfEET_S1_(float noundef %61)
  %63 = fpext float %62 to double
  %64 = call double @sin(double noundef %63) #6
  %65 = getelementptr inbounds %class.SceneCamera, ptr %9, i32 0, i32 6
  %66 = load float, ptr %65, align 4, !tbaa !17
  %67 = call noundef float @_ZN3glm7radiansIfEET_S1_(float noundef %66)
  %68 = fpext float %67 to double
  %69 = call double @cos(double noundef %68) #6
  %70 = fmul double %64, %69
  %71 = fptrunc double %70 to float
  %72 = getelementptr inbounds %"struct.glm::vec", ptr %6, i32 0, i32 2
  store float %71, ptr %72, align 4, !tbaa !10
  call void @llvm.lifetime.start.p0(i64 12, ptr %7) #6
  %73 = call { <2 x float>, float } @_ZN3glm9normalizeILi3EfLNS_9qualifierE0EEENS_3vecIXT_ET0_XT1_EEERKS4_(ptr noundef nonnull align 4 dereferenceable(12) %6)
  store { <2 x float>, float } %73, ptr %8, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %7, ptr align 8 %8, i64 12, i1 false)
  %74 = getelementptr inbounds %class.SceneCamera, ptr %9, i32 0, i32 1
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %74, ptr align 4 %7, i64 12, i1 false), !tbaa.struct !18
  call void @llvm.lifetime.end.p0(i64 12, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 12, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #6
  ret void
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local <2 x float> @_ZN3glmmiIfLNS_9qualifierE0EEENS_3vecILi2ET_XT0_EEERKS4_S6_(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(8)) #4

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(8) ptr @_ZN3glm3vecILi2EfLNS_9qualifierE0EEmLIfEERS2_T_(ptr noundef nonnull align 4 dereferenceable(8), float noundef) #2 align 2

; Function Attrs: nounwind
declare double @cos(double noundef) #5

; Function Attrs: nounwind
declare double @sin(double noundef) #5

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local { <2 x float>, float } @_ZN3glm9normalizeILi3EfLNS_9qualifierE0EEENS_3vecIXT_ET0_XT1_EEERKS4_(ptr noundef nonnull align 4 dereferenceable(12)) #4

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = { mustprogress 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 #4 = { inlinehint mustprogress 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 #5 = { nounwind "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 #6 = { 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 = !{i64 0, i64 4, !10, i64 4, i64 4, !10}
!10 = !{!7, !7, i64 0}
!11 = !{!12, !14, i64 36}
!12 = !{!"_ZTS11SceneCamera", !13, i64 0, !13, i64 12, !13, i64 24, !14, i64 36, !15, i64 40, !14, i64 48, !14, i64 52, !14, i64 56}
!13 = !{!"_ZTSN3glm3vecILi3EfLNS_9qualifierE0EEE", !7, i64 0, !7, i64 4, !7, i64 8}
!14 = !{!"float", !7, i64 0}
!15 = !{!"_ZTSN3glm3vecILi2EfLNS_9qualifierE0EEE", !7, i64 0, !7, i64 4}
!16 = !{!12, !14, i64 48}
!17 = !{!12, !14, i64 52}
!18 = !{i64 0, i64 4, !10, i64 4, i64 4, !10, i64 8, i64 4, !10}


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

%"struct.glm::vec.2" = type { %union.anon.3, %union.anon.4 }
%union.anon.3 = type { float }
%union.anon.4 = type { float }
%"struct.glm::vec" = type { %union.anon, %union.anon.0, %union.anon.1 }
%union.anon = type { float }
%union.anon.0 = type { float }
%union.anon.1 = type { float }

; 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: inlinehint mustprogress nounwind uwtable
declare dso_local noundef float @_ZN3glm7radiansIfEET_S1_(float noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN11SceneCamera13MouseRotationERKN3glm3vecILi2EfLNS0_9qualifierE0EEE(ptr noundef nonnull align 4 dereferenceable(60) %0, ptr noundef nonnull align 4 dereferenceable(8) %1) local_unnamed_addr #2 align 2 {
  %3 = alloca %"struct.glm::vec.2", align 8
  %4 = alloca %"struct.glm::vec", align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #5
  %5 = getelementptr inbounds i8, ptr %0, i64 40
  %6 = tail call <2 x float> @_ZN3glmmiIfLNS_9qualifierE0EEENS_3vecILi2ET_XT0_EEERKS4_S6_(ptr noundef nonnull align 4 dereferenceable(8) %1, ptr noundef nonnull align 4 dereferenceable(8) %5)
  store <2 x float> %6, ptr %3, align 8
  %7 = load i64, ptr %1, align 4
  store i64 %7, ptr %5, align 4
  %8 = getelementptr inbounds i8, ptr %0, i64 36
  %9 = load float, ptr %8, align 4, !tbaa !5
  %10 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZN3glm3vecILi2EfLNS_9qualifierE0EEmLIfEERS2_T_(ptr noundef nonnull align 4 dereferenceable(8) %3, float noundef %9)
  %11 = load float, ptr %3, align 8, !tbaa !12
  %12 = getelementptr inbounds i8, ptr %0, i64 48
  %13 = load float, ptr %12, align 4, !tbaa !13
  %14 = fadd float %11, %13
  store float %14, ptr %12, align 4, !tbaa !13
  %15 = getelementptr inbounds i8, ptr %3, i64 4
  %16 = load float, ptr %15, align 4, !tbaa !12
  %17 = getelementptr inbounds i8, ptr %0, i64 52
  %18 = load float, ptr %17, align 4, !tbaa !14
  %19 = fsub float %18, %16
  %20 = fcmp ogt float %19, 8.900000e+01
  %storemerge = select i1 %20, float 8.900000e+01, float %19
  %21 = fcmp olt float %storemerge, -8.900000e+01
  %storemerge4 = select i1 %21, float -8.900000e+01, float %storemerge
  store float %storemerge4, ptr %17, align 4, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %4) #5
  %22 = call noundef float @_ZN3glm7radiansIfEET_S1_(float noundef %14)
  %23 = fpext float %22 to double
  %24 = call double @cos(double noundef %23) #5
  %25 = load float, ptr %17, align 4, !tbaa !14
  %26 = call noundef float @_ZN3glm7radiansIfEET_S1_(float noundef %25)
  %27 = fpext float %26 to double
  %28 = call double @cos(double noundef %27) #5
  %29 = fmul double %24, %28
  %30 = fptrunc double %29 to float
  store float %30, ptr %4, align 4, !tbaa !12
  %31 = load float, ptr %17, align 4, !tbaa !14
  %32 = call noundef float @_ZN3glm7radiansIfEET_S1_(float noundef %31)
  %33 = fpext float %32 to double
  %34 = call double @sin(double noundef %33) #5
  %35 = fptrunc double %34 to float
  %36 = getelementptr inbounds i8, ptr %4, i64 4
  store float %35, ptr %36, align 4, !tbaa !12
  %37 = load float, ptr %12, align 4, !tbaa !13
  %38 = call noundef float @_ZN3glm7radiansIfEET_S1_(float noundef %37)
  %39 = fpext float %38 to double
  %40 = call double @sin(double noundef %39) #5
  %41 = load float, ptr %17, align 4, !tbaa !14
  %42 = call noundef float @_ZN3glm7radiansIfEET_S1_(float noundef %41)
  %43 = fpext float %42 to double
  %44 = call double @cos(double noundef %43) #5
  %45 = fmul double %40, %44
  %46 = fptrunc double %45 to float
  %47 = getelementptr inbounds i8, ptr %4, i64 8
  store float %46, ptr %47, align 4, !tbaa !12
  %48 = call { <2 x float>, float } @_ZN3glm9normalizeILi3EfLNS_9qualifierE0EEENS_3vecIXT_ET0_XT1_EEERKS4_(ptr noundef nonnull align 4 dereferenceable(12) %4)
  %.fca.0.extract = extractvalue { <2 x float>, float } %48, 0
  %.fca.1.extract = extractvalue { <2 x float>, float } %48, 1
  %49 = getelementptr inbounds i8, ptr %0, i64 12
  store <2 x float> %.fca.0.extract, ptr %49, align 4
  %.sroa.4.0..sroa_idx = getelementptr inbounds i8, ptr %0, i64 20
  store float %.fca.1.extract, ptr %.sroa.4.0..sroa_idx, align 4, !tbaa !12
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %4) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #5
  ret void
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local <2 x float> @_ZN3glmmiIfLNS_9qualifierE0EEENS_3vecILi2ET_XT0_EEERKS4_S6_(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(8)) local_unnamed_addr #3

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(8) ptr @_ZN3glm3vecILi2EfLNS_9qualifierE0EEmLIfEERS2_T_(ptr noundef nonnull align 4 dereferenceable(8), float noundef) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @cos(double noundef) local_unnamed_addr #4

; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @sin(double noundef) local_unnamed_addr #4

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local { <2 x float>, float } @_ZN3glm9normalizeILi3EfLNS_9qualifierE0EEENS_3vecIXT_ET0_XT1_EEERKS4_(ptr noundef nonnull align 4 dereferenceable(12)) local_unnamed_addr #3

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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" }
attributes #2 = { mustprogress 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 #3 = { inlinehint mustprogress 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 #4 = { mustprogress nofree nounwind willreturn memory(write) "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 #5 = { 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, !10, i64 36}
!6 = !{!"_ZTS11SceneCamera", !7, i64 0, !7, i64 12, !7, i64 24, !10, i64 36, !11, i64 40, !10, i64 48, !10, i64 52, !10, i64 56}
!7 = !{!"_ZTSN3glm3vecILi3EfLNS_9qualifierE0EEE", !8, i64 0, !8, i64 4, !8, i64 8}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"float", !8, i64 0}
!11 = !{!"_ZTSN3glm3vecILi2EfLNS_9qualifierE0EEE", !8, i64 0, !8, i64 4}
!12 = !{!8, !8, i64 0}
!13 = !{!6, !10, i64 48}
!14 = !{!6, !10, i64 52}


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