; LLVM IR from achilles288/robot-monitor-graphics :: src/base/object2d.ll (ZN3rmg8Object2D11setRotationEf)

; 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.rmg::Object2D" = type <{ %"class.rmg::Object", i8, [3 x i8], i32, i32, %"struct.rmg::Mat3", float, %"struct.rmg::Vec2", [4 x i8] }>
%"class.rmg::Object" = type { ptr, i64, ptr, %"struct.rmg::ColorRGBA", i8, i32 }
%"struct.rmg::ColorRGBA" = type { float, float, float, float }
%"struct.rmg::Mat3" = type { %union.anon }
%union.anon = type { [3 x [3 x float]] }
%"struct.rmg::Vec2" = type { %union.anon.0 }
%union.anon.0 = type { %struct.anon }
%struct.anon = type { float, float }

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 4 dereferenceable(12) ptr @_ZN3rmg4Mat3ixEh(ptr noundef nonnull align 4 dereferenceable(36), i8 noundef zeroext) #0 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZN3rmg7Mat3RowixEh(ptr noundef nonnull align 4 dereferenceable(12), i8 noundef zeroext) #0 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3rmg8Object2D11setRotationEf(ptr noundef nonnull align 8 dereferenceable(108) %0, float noundef %1) #1 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca float, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store float %1, ptr %4, align 4, !tbaa !9
  %5 = load ptr, ptr %3, align 8
  %6 = load float, ptr %4, align 4, !tbaa !9
  %7 = getelementptr inbounds %"class.rmg::Object2D", ptr %5, i32 0, i32 6
  store float %6, ptr %7, align 8, !tbaa !11
  %8 = load float, ptr %4, align 4, !tbaa !9
  %9 = fpext float %8 to double
  %10 = call double @cos(double noundef %9) #3
  %11 = getelementptr inbounds %"class.rmg::Object2D", ptr %5, i32 0, i32 7
  %12 = getelementptr inbounds %"struct.rmg::Vec2", ptr %11, i32 0, i32 0
  %13 = getelementptr inbounds %struct.anon, ptr %12, i32 0, i32 0
  %14 = load float, ptr %13, align 4, !tbaa !22
  %15 = fpext float %14 to double
  %16 = fmul double %10, %15
  %17 = fptrunc double %16 to float
  %18 = getelementptr inbounds %"class.rmg::Object2D", ptr %5, i32 0, i32 5
  %19 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZN3rmg4Mat3ixEh(ptr noundef nonnull align 4 dereferenceable(36) %18, i8 noundef zeroext 0)
  %20 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZN3rmg7Mat3RowixEh(ptr noundef nonnull align 4 dereferenceable(12) %19, i8 noundef zeroext 0)
  store float %17, ptr %20, align 4, !tbaa !9
  %21 = load float, ptr %4, align 4, !tbaa !9
  %22 = fpext float %21 to double
  %23 = call double @sin(double noundef %22) #3
  %24 = fneg double %23
  %25 = getelementptr inbounds %"class.rmg::Object2D", ptr %5, i32 0, i32 7
  %26 = getelementptr inbounds %"struct.rmg::Vec2", ptr %25, i32 0, i32 0
  %27 = getelementptr inbounds %struct.anon, ptr %26, i32 0, i32 1
  %28 = load float, ptr %27, align 4, !tbaa !22
  %29 = fpext float %28 to double
  %30 = fmul double %24, %29
  %31 = fptrunc double %30 to float
  %32 = getelementptr inbounds %"class.rmg::Object2D", ptr %5, i32 0, i32 5
  %33 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZN3rmg4Mat3ixEh(ptr noundef nonnull align 4 dereferenceable(36) %32, i8 noundef zeroext 0)
  %34 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZN3rmg7Mat3RowixEh(ptr noundef nonnull align 4 dereferenceable(12) %33, i8 noundef zeroext 1)
  store float %31, ptr %34, align 4, !tbaa !9
  %35 = load float, ptr %4, align 4, !tbaa !9
  %36 = fpext float %35 to double
  %37 = call double @sin(double noundef %36) #3
  %38 = getelementptr inbounds %"class.rmg::Object2D", ptr %5, i32 0, i32 7
  %39 = getelementptr inbounds %"struct.rmg::Vec2", ptr %38, i32 0, i32 0
  %40 = getelementptr inbounds %struct.anon, ptr %39, i32 0, i32 0
  %41 = load float, ptr %40, align 4, !tbaa !22
  %42 = fpext float %41 to double
  %43 = fmul double %37, %42
  %44 = fptrunc double %43 to float
  %45 = getelementptr inbounds %"class.rmg::Object2D", ptr %5, i32 0, i32 5
  %46 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZN3rmg4Mat3ixEh(ptr noundef nonnull align 4 dereferenceable(36) %45, i8 noundef zeroext 1)
  %47 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZN3rmg7Mat3RowixEh(ptr noundef nonnull align 4 dereferenceable(12) %46, i8 noundef zeroext 0)
  store float %44, ptr %47, align 4, !tbaa !9
  %48 = load float, ptr %4, align 4, !tbaa !9
  %49 = fpext float %48 to double
  %50 = call double @cos(double noundef %49) #3
  %51 = getelementptr inbounds %"class.rmg::Object2D", ptr %5, i32 0, i32 7
  %52 = getelementptr inbounds %"struct.rmg::Vec2", ptr %51, i32 0, i32 0
  %53 = getelementptr inbounds %struct.anon, ptr %52, i32 0, i32 1
  %54 = load float, ptr %53, align 4, !tbaa !22
  %55 = fpext float %54 to double
  %56 = fmul double %50, %55
  %57 = fptrunc double %56 to float
  %58 = getelementptr inbounds %"class.rmg::Object2D", ptr %5, i32 0, i32 5
  %59 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZN3rmg4Mat3ixEh(ptr noundef nonnull align 4 dereferenceable(36) %58, i8 noundef zeroext 1)
  %60 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZN3rmg7Mat3RowixEh(ptr noundef nonnull align 4 dereferenceable(12) %59, i8 noundef zeroext 1)
  store float %57, ptr %60, align 4, !tbaa !9
  ret void
}

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

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

attributes #0 = { 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 #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 = { 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 #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, !10, i64 0}
!10 = !{!"float", !7, i64 0}
!11 = !{!12, !10, i64 96}
!12 = !{!"_ZTSN3rmg8Object2DE", !13, i64 0, !7, i64 48, !18, i64 52, !19, i64 56, !20, i64 60, !10, i64 96, !21, i64 100}
!13 = !{!"_ZTSN3rmg6ObjectE", !14, i64 8, !6, i64 16, !15, i64 24, !16, i64 40, !17, i64 44}
!14 = !{!"long", !7, i64 0}
!15 = !{!"_ZTSN3rmg9ColorRGBAE", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12}
!16 = !{!"bool", !7, i64 0}
!17 = !{!"_ZTSN3rmg10ObjectTypeE", !7, i64 0}
!18 = !{!"_ZTSN3rmg9AlignmentE", !7, i64 0}
!19 = !{!"_ZTSN3rmg12Object2DTypeE", !7, i64 0}
!20 = !{!"_ZTSN3rmg4Mat3E", !7, i64 0}
!21 = !{!"_ZTSN3rmg4Vec2E", !7, i64 0}
!22 = !{!7, !7, 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: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 4 dereferenceable(12) ptr @_ZN3rmg4Mat3ixEh(ptr noundef nonnull align 4 dereferenceable(36), i8 noundef zeroext) local_unnamed_addr #0 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZN3rmg7Mat3RowixEh(ptr noundef nonnull align 4 dereferenceable(12), i8 noundef zeroext) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3rmg8Object2D11setRotationEf(ptr noundef nonnull align 8 dereferenceable(108) %0, float noundef %1) local_unnamed_addr #1 align 2 {
  %3 = getelementptr inbounds i8, ptr %0, i64 96
  store float %1, ptr %3, align 8, !tbaa !5
  %4 = fpext float %1 to double
  %5 = tail call double @cos(double noundef %4) #3
  %6 = getelementptr inbounds i8, ptr %0, i64 100
  %7 = load float, ptr %6, align 4, !tbaa !20
  %8 = fpext float %7 to double
  %9 = fmul double %5, %8
  %10 = fptrunc double %9 to float
  %11 = getelementptr inbounds i8, ptr %0, i64 60
  %12 = tail call noundef nonnull align 4 dereferenceable(12) ptr @_ZN3rmg4Mat3ixEh(ptr noundef nonnull align 4 dereferenceable(36) %11, i8 noundef zeroext 0)
  %13 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZN3rmg7Mat3RowixEh(ptr noundef nonnull align 4 dereferenceable(12) %12, i8 noundef zeroext 0)
  store float %10, ptr %13, align 4, !tbaa !21
  %14 = tail call double @sin(double noundef %4) #3
  %15 = fneg double %14
  %16 = getelementptr inbounds i8, ptr %0, i64 104
  %17 = load float, ptr %16, align 8, !tbaa !20
  %18 = fpext float %17 to double
  %19 = fmul double %15, %18
  %20 = fptrunc double %19 to float
  %21 = tail call noundef nonnull align 4 dereferenceable(12) ptr @_ZN3rmg4Mat3ixEh(ptr noundef nonnull align 4 dereferenceable(36) %11, i8 noundef zeroext 0)
  %22 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZN3rmg7Mat3RowixEh(ptr noundef nonnull align 4 dereferenceable(12) %21, i8 noundef zeroext 1)
  store float %20, ptr %22, align 4, !tbaa !21
  %23 = tail call double @sin(double noundef %4) #3
  %24 = load float, ptr %6, align 4, !tbaa !20
  %25 = fpext float %24 to double
  %26 = fmul double %23, %25
  %27 = fptrunc double %26 to float
  %28 = tail call noundef nonnull align 4 dereferenceable(12) ptr @_ZN3rmg4Mat3ixEh(ptr noundef nonnull align 4 dereferenceable(36) %11, i8 noundef zeroext 1)
  %29 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZN3rmg7Mat3RowixEh(ptr noundef nonnull align 4 dereferenceable(12) %28, i8 noundef zeroext 0)
  store float %27, ptr %29, align 4, !tbaa !21
  %30 = tail call double @cos(double noundef %4) #3
  %31 = load float, ptr %16, align 8, !tbaa !20
  %32 = fpext float %31 to double
  %33 = fmul double %30, %32
  %34 = fptrunc double %33 to float
  %35 = tail call noundef nonnull align 4 dereferenceable(12) ptr @_ZN3rmg4Mat3ixEh(ptr noundef nonnull align 4 dereferenceable(36) %11, i8 noundef zeroext 1)
  %36 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZN3rmg7Mat3RowixEh(ptr noundef nonnull align 4 dereferenceable(12) %35, i8 noundef zeroext 1)
  store float %34, ptr %36, align 4, !tbaa !21
  ret void
}

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

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

attributes #0 = { 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 #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 = { 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 #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, !13, i64 96}
!6 = !{!"_ZTSN3rmg8Object2DE", !7, i64 0, !9, i64 48, !16, i64 52, !17, i64 56, !18, i64 60, !13, i64 96, !19, i64 100}
!7 = !{!"_ZTSN3rmg6ObjectE", !8, i64 8, !11, i64 16, !12, i64 24, !14, i64 40, !15, i64 44}
!8 = !{!"long", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = !{!"any pointer", !9, i64 0}
!12 = !{!"_ZTSN3rmg9ColorRGBAE", !13, i64 0, !13, i64 4, !13, i64 8, !13, i64 12}
!13 = !{!"float", !9, i64 0}
!14 = !{!"bool", !9, i64 0}
!15 = !{!"_ZTSN3rmg10ObjectTypeE", !9, i64 0}
!16 = !{!"_ZTSN3rmg9AlignmentE", !9, i64 0}
!17 = !{!"_ZTSN3rmg12Object2DTypeE", !9, i64 0}
!18 = !{!"_ZTSN3rmg4Mat3E", !9, i64 0}
!19 = !{!"_ZTSN3rmg4Vec2E", !9, i64 0}
!20 = !{!9, !9, i64 0}
!21 = !{!13, !13, i64 0}


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