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

; 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: nounwind
declare double @cos(double noundef) #1

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

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

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 = { 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 #2 = { 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 #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 = !{!7, !7, i64 0}
!12 = !{!13, !10, i64 96}
!13 = !{!"_ZTSN3rmg8Object2DE", !14, i64 0, !7, i64 48, !19, i64 52, !20, i64 56, !21, i64 60, !10, i64 96, !22, i64 100}
!14 = !{!"_ZTSN3rmg6ObjectE", !15, i64 8, !6, i64 16, !16, i64 24, !17, i64 40, !18, i64 44}
!15 = !{!"long", !7, i64 0}
!16 = !{!"_ZTSN3rmg9ColorRGBAE", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12}
!17 = !{!"bool", !7, i64 0}
!18 = !{!"_ZTSN3rmg10ObjectTypeE", !7, i64 0}
!19 = !{!"_ZTSN3rmg9AlignmentE", !7, i64 0}
!20 = !{!"_ZTSN3rmg12Object2DTypeE", !7, i64 0}
!21 = !{!"_ZTSN3rmg4Mat3E", !7, i64 0}
!22 = !{!"_ZTSN3rmg4Vec2E", !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 nofree nounwind willreturn memory(write)
declare double @cos(double noundef) local_unnamed_addr #1

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

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

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


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