; LLVM IR from paroj/gltut :: glsdk/glutil/source/MousePoles.ll (ZN6glutil8ViewPole14ProcessYChangeEib)

; 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::detail::tquat" = type { float, float, float, float }
%"struct.glm::detail::tvec3" = type { %union.anon }
%union.anon = type { %struct.anon }
%struct.anon = type { float, float, float }
%"class.glutil::ViewPole" = type <{ %"class.glutil::ViewProvider", %"struct.glutil::ViewData", %"struct.glutil::ViewScale", %"struct.glutil::ViewData", i32, i8, i8, [2 x i8], i32, float, %"struct.glm::detail::tvec2", %"struct.glm::detail::tquat", [4 x i8] }>
%"class.glutil::ViewProvider" = type { ptr }
%"struct.glutil::ViewScale" = type { float, float, float, float, float, float, float }
%"struct.glutil::ViewData" = type { %"struct.glm::detail::tvec3", %"struct.glm::detail::tquat", float, float }
%"struct.glm::detail::tvec2" = type { %union.anon.2 }
%union.anon.2 = type { %struct.anon.3 }
%struct.anon.3 = type { i32, i32 }

; 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: inlinehint mustprogress uwtable
declare dso_local { <2 x float>, <2 x float> } @_ZN3glm6detailmlIfEENS0_5tquatIT_EERKS4_S6_(ptr noundef nonnull align 4 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(16)) #1

; 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) #2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN3glm6detail5tvec3IfEC2ERKfS4_S4_(ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) unnamed_addr #3 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN6glutil8ViewPole14ProcessYChangeEib(ptr noundef nonnull align 8 dereferenceable(148) %0, i32 noundef %1, i1 noundef zeroext %2) #4 align 2 {
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca i8, align 1
  %7 = alloca float, align 4
  %8 = alloca %"struct.glm::detail::tquat", align 4
  %9 = alloca %"struct.glm::detail::tquat", align 4
  %10 = alloca %"struct.glm::detail::tvec3", align 4
  %11 = alloca float, align 4
  %12 = alloca float, align 4
  %13 = alloca float, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store i32 %1, ptr %5, align 4, !tbaa !9
  %14 = zext i1 %2 to i8
  store i8 %14, ptr %6, align 1, !tbaa !11
  %15 = load ptr, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  %16 = load i32, ptr %5, align 4, !tbaa !9
  %17 = sitofp i32 %16 to float
  %18 = getelementptr inbounds %"class.glutil::ViewPole", ptr %15, i32 0, i32 2
  %19 = getelementptr inbounds %"struct.glutil::ViewScale", ptr %18, i32 0, i32 6
  %20 = load float, ptr %19, align 4, !tbaa !13
  %21 = fmul float %17, %20
  store float %21, ptr %7, align 4, !tbaa !24
  call void @llvm.lifetime.start.p0(i64 16, ptr %8) #5
  call void @llvm.lifetime.start.p0(i64 16, ptr %9) #5
  call void @llvm.lifetime.start.p0(i64 12, ptr %10) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  store float 1.000000e+00, ptr %11, align 4, !tbaa !24
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  store float 0.000000e+00, ptr %12, align 4, !tbaa !24
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #5
  store float 0.000000e+00, ptr %13, align 4, !tbaa !24
  call void @_ZN3glm6detail5tvec3IfEC2ERKfS4_S4_(ptr noundef nonnull align 4 dereferenceable(12) %10, ptr noundef nonnull align 4 dereferenceable(4) %11, ptr noundef nonnull align 4 dereferenceable(4) %12, ptr noundef nonnull align 4 dereferenceable(4) %13)
  %22 = call { <2 x float>, <2 x float> } @_ZN3glm9angleAxisIfEENS_6detail5tquatIT_EERKS3_RKNS1_5tvec3IS3_EE(ptr noundef nonnull align 4 dereferenceable(4) %7, ptr noundef nonnull align 4 dereferenceable(12) %10)
  %23 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %9, i32 0, i32 0
  %24 = extractvalue { <2 x float>, <2 x float> } %22, 0
  store <2 x float> %24, ptr %23, align 4
  %25 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %9, i32 0, i32 1
  %26 = extractvalue { <2 x float>, <2 x float> } %22, 1
  store <2 x float> %26, ptr %25, align 4
  %27 = getelementptr inbounds %"class.glutil::ViewPole", ptr %15, i32 0, i32 11
  %28 = call { <2 x float>, <2 x float> } @_ZN3glm6detailmlIfEENS0_5tquatIT_EERKS4_S6_(ptr noundef nonnull align 4 dereferenceable(16) %9, ptr noundef nonnull align 4 dereferenceable(16) %27)
  %29 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %8, i32 0, i32 0
  %30 = extractvalue { <2 x float>, <2 x float> } %28, 0
  store <2 x float> %30, ptr %29, align 4
  %31 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %8, i32 0, i32 1
  %32 = extractvalue { <2 x float>, <2 x float> } %28, 1
  store <2 x float> %32, ptr %31, align 4
  %33 = getelementptr inbounds %"class.glutil::ViewPole", ptr %15, i32 0, i32 1
  %34 = getelementptr inbounds %"struct.glutil::ViewData", ptr %33, i32 0, i32 1
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %34, ptr align 4 %8, i64 16, i1 false), !tbaa.struct !25
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 12, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  ret void
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { inlinehint 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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #4 = { 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 }

!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 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"bool", !7, i64 0}
!13 = !{!14, !19, i64 68}
!14 = !{!"_ZTSN6glutil8ViewPoleE", !15, i64 0, !16, i64 8, !20, i64 44, !16, i64 72, !21, i64 108, !12, i64 112, !12, i64 113, !22, i64 116, !19, i64 120, !23, i64 124, !18, i64 132}
!15 = !{!"_ZTSN6glutil12ViewProviderE"}
!16 = !{!"_ZTSN6glutil8ViewDataE", !17, i64 0, !18, i64 12, !19, i64 28, !19, i64 32}
!17 = !{!"_ZTSN3glm6detail5tvec3IfEE", !7, i64 0}
!18 = !{!"_ZTSN3glm6detail5tquatIfEE", !19, i64 0, !19, i64 4, !19, i64 8, !19, i64 12}
!19 = !{!"float", !7, i64 0}
!20 = !{!"_ZTSN6glutil9ViewScaleE", !19, i64 0, !19, i64 4, !19, i64 8, !19, i64 12, !19, i64 16, !19, i64 20, !19, i64 24}
!21 = !{!"_ZTSN6glutil12MouseButtonsE", !7, i64 0}
!22 = !{!"_ZTSN6glutil8ViewPole10RotateModeE", !7, i64 0}
!23 = !{!"_ZTSN3glm6detail5tvec2IiEE", !7, i64 0}
!24 = !{!19, !19, i64 0}
!25 = !{i64 0, i64 4, !24, i64 4, i64 4, !24, i64 8, i64 4, !24, i64 12, i64 4, !24}


; 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::detail::tquat" = type { float, float, float, float }
%"struct.glm::detail::tvec3" = type { %union.anon }
%union.anon = type { %struct.anon }
%struct.anon = type { float, float, 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 uwtable
declare dso_local { <2 x float>, <2 x float> } @_ZN3glm6detailmlIfEENS0_5tquatIT_EERKS4_S6_(ptr noundef nonnull align 4 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(16)) local_unnamed_addr #1

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN3glm6detail5tvec3IfEC2ERKfS4_S4_(ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) unnamed_addr #2 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN6glutil8ViewPole14ProcessYChangeEib(ptr noundef nonnull align 8 dereferenceable(148) %0, i32 noundef %1, i1 noundef zeroext %2) local_unnamed_addr #3 align 2 {
  %4 = alloca float, align 4
  %5 = alloca %"struct.glm::detail::tquat", align 8
  %6 = alloca %"struct.glm::detail::tvec3", align 4
  %7 = alloca float, align 4
  %8 = alloca float, align 4
  %9 = alloca float, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #4
  %10 = sitofp i32 %1 to float
  %11 = getelementptr inbounds i8, ptr %0, i64 68
  %12 = load float, ptr %11, align 4, !tbaa !5
  %13 = fmul float %12, %10
  store float %13, ptr %4, align 4, !tbaa !19
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %5) #4
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %6) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #4
  store float 1.000000e+00, ptr %7, align 4, !tbaa !19
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #4
  store float 0.000000e+00, ptr %8, align 4, !tbaa !19
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %9) #4
  store float 0.000000e+00, ptr %9, align 4, !tbaa !19
  call void @_ZN3glm6detail5tvec3IfEC2ERKfS4_S4_(ptr noundef nonnull align 4 dereferenceable(12) %6, ptr noundef nonnull align 4 dereferenceable(4) %7, ptr noundef nonnull align 4 dereferenceable(4) %8, ptr noundef nonnull align 4 dereferenceable(4) %9)
  %14 = call { <2 x float>, <2 x float> } @_ZN3glm9angleAxisIfEENS_6detail5tquatIT_EERKS3_RKNS1_5tvec3IS3_EE(ptr noundef nonnull align 4 dereferenceable(4) %4, ptr noundef nonnull align 4 dereferenceable(12) %6)
  %15 = extractvalue { <2 x float>, <2 x float> } %14, 0
  store <2 x float> %15, ptr %5, align 8
  %16 = getelementptr inbounds i8, ptr %5, i64 8
  %17 = extractvalue { <2 x float>, <2 x float> } %14, 1
  store <2 x float> %17, ptr %16, align 8
  %18 = getelementptr inbounds i8, ptr %0, i64 132
  %19 = call { <2 x float>, <2 x float> } @_ZN3glm6detailmlIfEENS0_5tquatIT_EERKS4_S6_(ptr noundef nonnull align 4 dereferenceable(16) %5, ptr noundef nonnull align 4 dereferenceable(16) %18)
  %20 = extractvalue { <2 x float>, <2 x float> } %19, 0
  %21 = extractvalue { <2 x float>, <2 x float> } %19, 1
  %22 = getelementptr inbounds i8, ptr %0, i64 20
  store <2 x float> %20, ptr %22, align 4
  %.sroa.4.0..sroa_idx = getelementptr inbounds i8, ptr %0, i64 28
  store <2 x float> %21, ptr %.sroa.4.0..sroa_idx, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %9) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #4
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %6) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %5) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #4
  ret void
}

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { inlinehint 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 = { 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 = { 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, !13, i64 68}
!6 = !{!"_ZTSN6glutil8ViewPoleE", !7, i64 0, !8, i64 8, !14, i64 44, !8, i64 72, !15, i64 108, !16, i64 112, !16, i64 113, !17, i64 116, !13, i64 120, !18, i64 124, !12, i64 132}
!7 = !{!"_ZTSN6glutil12ViewProviderE"}
!8 = !{!"_ZTSN6glutil8ViewDataE", !9, i64 0, !12, i64 12, !13, i64 28, !13, i64 32}
!9 = !{!"_ZTSN3glm6detail5tvec3IfEE", !10, i64 0}
!10 = !{!"omnipotent char", !11, i64 0}
!11 = !{!"Simple C++ TBAA"}
!12 = !{!"_ZTSN3glm6detail5tquatIfEE", !13, i64 0, !13, i64 4, !13, i64 8, !13, i64 12}
!13 = !{!"float", !10, i64 0}
!14 = !{!"_ZTSN6glutil9ViewScaleE", !13, i64 0, !13, i64 4, !13, i64 8, !13, i64 12, !13, i64 16, !13, i64 20, !13, i64 24}
!15 = !{!"_ZTSN6glutil12MouseButtonsE", !10, i64 0}
!16 = !{!"bool", !10, i64 0}
!17 = !{!"_ZTSN6glutil8ViewPole10RotateModeE", !10, i64 0}
!18 = !{!"_ZTSN3glm6detail5tvec2IiEE", !10, i64 0}
!19 = !{!13, !13, i64 0}


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