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

; 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 }
%"class.glutil::ObjectPole" = type { ptr, %"struct.glutil::ObjectData", %"struct.glutil::ObjectData", float, i32, i32, i8, %"struct.glm::detail::tvec2", %"struct.glm::detail::tvec2", %"struct.glm::detail::tquat" }
%"struct.glutil::ObjectData" = type { %"struct.glm::detail::tvec3", %"struct.glm::detail::tquat" }
%"struct.glm::detail::tvec3" = type { %union.anon }
%union.anon = type { %struct.anon }
%struct.anon = type { float, 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> } @_ZN3glm9normalizeIfEENS_6detail5tquatIT_EERKS4_(ptr noundef nonnull align 4 dereferenceable(16)) #1

; 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: mustprogress uwtable
define dso_local void @_ZN6glutil10ObjectPole18RotateLocalDegreesERKN3glm6detail5tquatIfEEb(ptr noundef nonnull align 8 dereferenceable(112) %0, ptr noundef nonnull align 4 dereferenceable(16) %1, i1 noundef zeroext %2) #3 align 2 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i8, align 1
  %7 = alloca %"struct.glm::detail::tquat", align 4
  %8 = alloca %"struct.glm::detail::tquat", align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  %9 = zext i1 %2 to i8
  store i8 %9, ptr %6, align 1, !tbaa !9
  %10 = load ptr, ptr %4, align 8
  %11 = getelementptr inbounds %"class.glutil::ObjectPole", ptr %10, i32 0, i32 6
  %12 = load i8, ptr %11, align 4, !tbaa !11, !range !20, !noundef !21
  %13 = trunc i8 %12 to i1
  br i1 %13, label %15, label %14

14:                                               ; preds = %3
  store i8 0, ptr %6, align 1, !tbaa !9
  br label %15

15:                                               ; preds = %14, %3
  call void @llvm.lifetime.start.p0(i64 16, ptr %7) #4
  call void @llvm.lifetime.start.p0(i64 16, ptr %8) #4
  %16 = load i8, ptr %6, align 1, !tbaa !9, !range !20, !noundef !21
  %17 = trunc i8 %16 to i1
  br i1 %17, label %18, label %20

18:                                               ; preds = %15
  %19 = getelementptr inbounds %"class.glutil::ObjectPole", ptr %10, i32 0, i32 9
  br label %23

20:                                               ; preds = %15
  %21 = getelementptr inbounds %"class.glutil::ObjectPole", ptr %10, i32 0, i32 1
  %22 = getelementptr inbounds %"struct.glutil::ObjectData", ptr %21, i32 0, i32 1
  br label %23

23:                                               ; preds = %20, %18
  %24 = phi ptr [ %19, %18 ], [ %22, %20 ]
  %25 = load ptr, ptr %5, align 8, !tbaa !5
  %26 = call { <2 x float>, <2 x float> } @_ZN3glm6detailmlIfEENS0_5tquatIT_EERKS4_S6_(ptr noundef nonnull align 4 dereferenceable(16) %24, ptr noundef nonnull align 4 dereferenceable(16) %25)
  %27 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %8, i32 0, i32 0
  %28 = extractvalue { <2 x float>, <2 x float> } %26, 0
  store <2 x float> %28, ptr %27, align 4
  %29 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %8, i32 0, i32 1
  %30 = extractvalue { <2 x float>, <2 x float> } %26, 1
  store <2 x float> %30, ptr %29, align 4
  %31 = call { <2 x float>, <2 x float> } @_ZN3glm9normalizeIfEENS_6detail5tquatIT_EERKS4_(ptr noundef nonnull align 4 dereferenceable(16) %8)
  %32 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %7, i32 0, i32 0
  %33 = extractvalue { <2 x float>, <2 x float> } %31, 0
  store <2 x float> %33, ptr %32, align 4
  %34 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %7, i32 0, i32 1
  %35 = extractvalue { <2 x float>, <2 x float> } %31, 1
  store <2 x float> %35, ptr %34, align 4
  %36 = getelementptr inbounds %"class.glutil::ObjectPole", ptr %10, i32 0, i32 1
  %37 = getelementptr inbounds %"struct.glutil::ObjectData", ptr %36, i32 0, i32 1
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %37, ptr align 4 %7, i64 16, i1 false), !tbaa.struct !22
  call void @llvm.lifetime.end.p0(i64 16, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr %7) #4
  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 = { 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, !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 = !{!"bool", !7, i64 0}
!11 = !{!12, !10, i64 76}
!12 = !{!"_ZTSN6glutil10ObjectPoleE", !6, i64 0, !13, i64 8, !13, i64 36, !16, i64 64, !17, i64 68, !18, i64 72, !10, i64 76, !19, i64 80, !19, i64 88, !15, i64 96}
!13 = !{!"_ZTSN6glutil10ObjectDataE", !14, i64 0, !15, i64 12}
!14 = !{!"_ZTSN3glm6detail5tvec3IfEE", !7, i64 0}
!15 = !{!"_ZTSN3glm6detail5tquatIfEE", !16, i64 0, !16, i64 4, !16, i64 8, !16, i64 12}
!16 = !{!"float", !7, i64 0}
!17 = !{!"_ZTSN6glutil12MouseButtonsE", !7, i64 0}
!18 = !{!"_ZTSN6glutil10ObjectPole10RotateModeE", !7, i64 0}
!19 = !{!"_ZTSN3glm6detail5tvec2IiEE", !7, i64 0}
!20 = !{i8 0, i8 2}
!21 = !{}
!22 = !{i64 0, i64 4, !23, i64 4, i64 4, !23, i64 8, i64 4, !23, i64 12, i64 4, !23}
!23 = !{!16, !16, 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"

%"struct.glm::detail::tquat" = type { float, 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> } @_ZN3glm9normalizeIfEENS_6detail5tquatIT_EERKS4_(ptr noundef nonnull align 4 dereferenceable(16)) local_unnamed_addr #1

; 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: mustprogress uwtable
define dso_local void @_ZN6glutil10ObjectPole18RotateLocalDegreesERKN3glm6detail5tquatIfEEb(ptr noundef nonnull align 8 dereferenceable(112) %0, ptr noundef nonnull align 4 dereferenceable(16) %1, i1 noundef zeroext %2) local_unnamed_addr #2 align 2 {
  %4 = alloca %"struct.glm::detail::tquat", align 8
  %5 = getelementptr inbounds i8, ptr %0, i64 76
  %6 = load i8, ptr %5, align 4, !tbaa !5, !range !18, !noundef !19
  %7 = trunc nuw i8 %6 to i1
  %narrow = and i1 %7, %2
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %4) #3
  %8 = getelementptr inbounds i8, ptr %0, i64 96
  %9 = getelementptr inbounds i8, ptr %0, i64 20
  %10 = select i1 %narrow, ptr %8, ptr %9
  %11 = tail call { <2 x float>, <2 x float> } @_ZN3glm6detailmlIfEENS0_5tquatIT_EERKS4_S6_(ptr noundef nonnull align 4 dereferenceable(16) %10, ptr noundef nonnull align 4 dereferenceable(16) %1)
  %12 = extractvalue { <2 x float>, <2 x float> } %11, 0
  store <2 x float> %12, ptr %4, align 8
  %13 = getelementptr inbounds i8, ptr %4, i64 8
  %14 = extractvalue { <2 x float>, <2 x float> } %11, 1
  store <2 x float> %14, ptr %13, align 8
  %15 = call { <2 x float>, <2 x float> } @_ZN3glm9normalizeIfEENS_6detail5tquatIT_EERKS4_(ptr noundef nonnull align 4 dereferenceable(16) %4)
  %16 = extractvalue { <2 x float>, <2 x float> } %15, 0
  %17 = extractvalue { <2 x float>, <2 x float> } %15, 1
  store <2 x float> %16, ptr %9, align 4
  %.sroa.4.0..sroa_idx = getelementptr inbounds i8, ptr %0, i64 28
  store <2 x float> %17, ptr %.sroa.4.0..sroa_idx, align 4
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #3
  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 = { 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 = { 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, !16, i64 76}
!6 = !{!"_ZTSN6glutil10ObjectPoleE", !7, i64 0, !10, i64 8, !10, i64 36, !13, i64 64, !14, i64 68, !15, i64 72, !16, i64 76, !17, i64 80, !17, i64 88, !12, i64 96}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"_ZTSN6glutil10ObjectDataE", !11, i64 0, !12, i64 12}
!11 = !{!"_ZTSN3glm6detail5tvec3IfEE", !8, i64 0}
!12 = !{!"_ZTSN3glm6detail5tquatIfEE", !13, i64 0, !13, i64 4, !13, i64 8, !13, i64 12}
!13 = !{!"float", !8, i64 0}
!14 = !{!"_ZTSN6glutil12MouseButtonsE", !8, i64 0}
!15 = !{!"_ZTSN6glutil10ObjectPole10RotateModeE", !8, i64 0}
!16 = !{!"bool", !8, i64 0}
!17 = !{!"_ZTSN3glm6detail5tvec2IiEE", !8, i64 0}
!18 = !{i8 0, i8 2}
!19 = !{}


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