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

%"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 }
%"struct.glm::detail::tquat" = type { float, float, float, float }

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6glutil10ObjectPole9MouseMoveERKN3glm6detail5tvec2IiEE(ptr noundef nonnull align 8 dereferenceable(112), ptr noundef nonnull align 4 dereferenceable(8)) #1 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN6glutil10ObjectPole10MouseClickENS_12MouseButtonsEbiRKN3glm6detail5tvec2IiEE(ptr noundef nonnull align 8 dereferenceable(112) %0, i32 noundef %1, i1 noundef zeroext %2, i32 noundef %3, ptr noundef nonnull align 4 dereferenceable(8) %4) #3 align 2 {
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i8, align 1
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  store ptr %0, ptr %6, align 8, !tbaa !5
  store i32 %1, ptr %7, align 4, !tbaa !9
  %11 = zext i1 %2 to i8
  store i8 %11, ptr %8, align 1, !tbaa !11
  store i32 %3, ptr %9, align 4, !tbaa !13
  store ptr %4, ptr %10, align 8, !tbaa !5
  %12 = load ptr, ptr %6, align 8
  %13 = load i8, ptr %8, align 1, !tbaa !11, !range !15, !noundef !16
  %14 = trunc i8 %13 to i1
  br i1 %14, label %15, label %52

15:                                               ; preds = %5
  %16 = getelementptr inbounds %"class.glutil::ObjectPole", ptr %12, i32 0, i32 6
  %17 = load i8, ptr %16, align 4, !tbaa !17, !range !15, !noundef !16
  %18 = trunc i8 %17 to i1
  br i1 %18, label %51, label %19

19:                                               ; preds = %15
  %20 = load i32, ptr %7, align 4, !tbaa !9
  %21 = getelementptr inbounds %"class.glutil::ObjectPole", ptr %12, i32 0, i32 4
  %22 = load i32, ptr %21, align 4, !tbaa !25
  %23 = icmp eq i32 %20, %22
  br i1 %23, label %24, label %50

24:                                               ; preds = %19
  %25 = load i32, ptr %9, align 4, !tbaa !13
  %26 = and i32 %25, 4
  %27 = icmp ne i32 %26, 0
  br i1 %27, label %28, label %30

28:                                               ; preds = %24
  %29 = getelementptr inbounds %"class.glutil::ObjectPole", ptr %12, i32 0, i32 5
  store i32 2, ptr %29, align 8, !tbaa !26
  br label %39

30:                                               ; preds = %24
  %31 = load i32, ptr %9, align 4, !tbaa !13
  %32 = and i32 %31, 2
  %33 = icmp ne i32 %32, 0
  br i1 %33, label %34, label %36

34:                                               ; preds = %30
  %35 = getelementptr inbounds %"class.glutil::ObjectPole", ptr %12, i32 0, i32 5
  store i32 1, ptr %35, align 8, !tbaa !26
  br label %38

36:                                               ; preds = %30
  %37 = getelementptr inbounds %"class.glutil::ObjectPole", ptr %12, i32 0, i32 5
  store i32 0, ptr %37, align 8, !tbaa !26
  br label %38

38:                                               ; preds = %36, %34
  br label %39

39:                                               ; preds = %38, %28
  %40 = load ptr, ptr %10, align 8, !tbaa !5
  %41 = getelementptr inbounds %"class.glutil::ObjectPole", ptr %12, i32 0, i32 7
  %42 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZN3glm6detail5tvec2IiEaSERKS2_(ptr noundef nonnull align 4 dereferenceable(8) %41, ptr noundef nonnull align 4 dereferenceable(8) %40)
  %43 = load ptr, ptr %10, align 8, !tbaa !5
  %44 = getelementptr inbounds %"class.glutil::ObjectPole", ptr %12, i32 0, i32 8
  %45 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZN3glm6detail5tvec2IiEaSERKS2_(ptr noundef nonnull align 4 dereferenceable(8) %44, ptr noundef nonnull align 4 dereferenceable(8) %43)
  %46 = getelementptr inbounds %"class.glutil::ObjectPole", ptr %12, i32 0, i32 1
  %47 = getelementptr inbounds %"struct.glutil::ObjectData", ptr %46, i32 0, i32 1
  %48 = getelementptr inbounds %"class.glutil::ObjectPole", ptr %12, i32 0, i32 9
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %48, ptr align 4 %47, i64 16, i1 false), !tbaa.struct !27
  %49 = getelementptr inbounds %"class.glutil::ObjectPole", ptr %12, i32 0, i32 6
  store i8 1, ptr %49, align 4, !tbaa !17
  br label %50

50:                                               ; preds = %39, %19
  br label %51

51:                                               ; preds = %50, %15
  br label %66

52:                                               ; preds = %5
  %53 = getelementptr inbounds %"class.glutil::ObjectPole", ptr %12, i32 0, i32 6
  %54 = load i8, ptr %53, align 4, !tbaa !17, !range !15, !noundef !16
  %55 = trunc i8 %54 to i1
  br i1 %55, label %56, label %65

56:                                               ; preds = %52
  %57 = load i32, ptr %7, align 4, !tbaa !9
  %58 = getelementptr inbounds %"class.glutil::ObjectPole", ptr %12, i32 0, i32 4
  %59 = load i32, ptr %58, align 4, !tbaa !25
  %60 = icmp eq i32 %57, %59
  br i1 %60, label %61, label %64

61:                                               ; preds = %56
  %62 = load ptr, ptr %10, align 8, !tbaa !5
  call void @_ZN6glutil10ObjectPole9MouseMoveERKN3glm6detail5tvec2IiEE(ptr noundef nonnull align 8 dereferenceable(112) %12, ptr noundef nonnull align 4 dereferenceable(8) %62)
  %63 = getelementptr inbounds %"class.glutil::ObjectPole", ptr %12, i32 0, i32 6
  store i8 0, ptr %63, align 4, !tbaa !17
  br label %64

64:                                               ; preds = %61, %56
  br label %65

65:                                               ; preds = %64, %52
  br label %66

66:                                               ; preds = %65, %51
  ret void
}

attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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"="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, !10, i64 0}
!10 = !{!"_ZTSN6glutil12MouseButtonsE", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"bool", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"int", !7, i64 0}
!15 = !{i8 0, i8 2}
!16 = !{}
!17 = !{!18, !12, i64 76}
!18 = !{!"_ZTSN6glutil10ObjectPoleE", !6, i64 0, !19, i64 8, !19, i64 36, !22, i64 64, !10, i64 68, !23, i64 72, !12, i64 76, !24, i64 80, !24, i64 88, !21, i64 96}
!19 = !{!"_ZTSN6glutil10ObjectDataE", !20, i64 0, !21, i64 12}
!20 = !{!"_ZTSN3glm6detail5tvec3IfEE", !7, i64 0}
!21 = !{!"_ZTSN3glm6detail5tquatIfEE", !22, i64 0, !22, i64 4, !22, i64 8, !22, i64 12}
!22 = !{!"float", !7, i64 0}
!23 = !{!"_ZTSN6glutil10ObjectPole10RotateModeE", !7, i64 0}
!24 = !{!"_ZTSN3glm6detail5tvec2IiEE", !7, i64 0}
!25 = !{!18, !10, i64 68}
!26 = !{!18, !23, i64 72}
!27 = !{i64 0, i64 4, !28, i64 4, i64 4, !28, i64 8, i64 4, !28, i64 12, i64 4, !28}
!28 = !{!22, !22, 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"

; Function Attrs: mustprogress 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) #0

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6glutil10ObjectPole9MouseMoveERKN3glm6detail5tvec2IiEE(ptr noundef nonnull align 8 dereferenceable(112), ptr noundef nonnull align 4 dereferenceable(8)) local_unnamed_addr #1 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN6glutil10ObjectPole10MouseClickENS_12MouseButtonsEbiRKN3glm6detail5tvec2IiEE(ptr noundef nonnull align 8 dereferenceable(112) %0, i32 noundef %1, i1 noundef zeroext %2, i32 noundef %3, ptr noundef nonnull align 4 dereferenceable(8) %4) local_unnamed_addr #3 align 2 {
  %6 = getelementptr inbounds i8, ptr %0, i64 76
  %7 = load i8, ptr %6, align 4, !tbaa !5, !range !18, !noundef !19
  %8 = trunc nuw i8 %7 to i1
  %9 = getelementptr inbounds i8, ptr %0, i64 68
  %10 = load i32, ptr %9, align 4
  br i1 %2, label %11, label %29

11:                                               ; preds = %5
  %12 = icmp ne i32 %10, %1
  %or.cond.not = select i1 %8, i1 true, i1 %12
  br i1 %or.cond.not, label %32, label %13

13:                                               ; preds = %11
  %14 = and i32 %3, 4
  %.not = icmp eq i32 %14, 0
  br i1 %.not, label %17, label %15

15:                                               ; preds = %13
  %16 = getelementptr inbounds i8, ptr %0, i64 72
  store i32 2, ptr %16, align 8, !tbaa !20
  br label %22

17:                                               ; preds = %13
  %18 = and i32 %3, 2
  %.not8 = icmp eq i32 %18, 0
  %19 = getelementptr inbounds i8, ptr %0, i64 72
  br i1 %.not8, label %21, label %20

20:                                               ; preds = %17
  store i32 1, ptr %19, align 8, !tbaa !20
  br label %22

21:                                               ; preds = %17
  store i32 0, ptr %19, align 8, !tbaa !20
  br label %22

22:                                               ; preds = %20, %21, %15
  %23 = getelementptr inbounds i8, ptr %0, i64 80
  %24 = tail call noundef nonnull align 4 dereferenceable(8) ptr @_ZN3glm6detail5tvec2IiEaSERKS2_(ptr noundef nonnull align 4 dereferenceable(8) %23, ptr noundef nonnull align 4 dereferenceable(8) %4)
  %25 = getelementptr inbounds i8, ptr %0, i64 88
  %26 = tail call noundef nonnull align 4 dereferenceable(8) ptr @_ZN3glm6detail5tvec2IiEaSERKS2_(ptr noundef nonnull align 4 dereferenceable(8) %25, ptr noundef nonnull align 4 dereferenceable(8) %4)
  %27 = getelementptr inbounds i8, ptr %0, i64 20
  %28 = getelementptr inbounds i8, ptr %0, i64 96
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %28, ptr noundef nonnull align 4 dereferenceable(16) %27, i64 16, i1 false), !tbaa.struct !21
  br label %.sink.split

29:                                               ; preds = %5
  %30 = icmp eq i32 %10, %1
  %or.cond14 = select i1 %8, i1 %30, i1 false
  br i1 %or.cond14, label %31, label %32

31:                                               ; preds = %29
  tail call void @_ZN6glutil10ObjectPole9MouseMoveERKN3glm6detail5tvec2IiEE(ptr noundef nonnull align 8 dereferenceable(112) %0, ptr noundef nonnull align 4 dereferenceable(8) %4)
  br label %.sink.split

.sink.split:                                      ; preds = %22, %31
  %.sink = phi i8 [ 0, %31 ], [ 1, %22 ]
  store i8 %.sink, ptr %6, align 4, !tbaa !5
  br label %32

32:                                               ; preds = %.sink.split, %29, %11
  ret void
}

attributes #0 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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"="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, !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 = !{}
!20 = !{!6, !15, i64 72}
!21 = !{i64 0, i64 4, !22, i64 4, i64 4, !22, i64 8, i64 4, !22, i64 12, i64 4, !22}
!22 = !{!13, !13, i64 0}


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