; LLVM IR from unitreerobotics/kinect_teleoperate :: src/sample_helper_libs/window_controller_3d (ViewControl)

; 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.ViewControl = type { %struct.ViewParameters, %struct.Viewport, i8, float, float, float }
%struct.ViewParameters = type { [3 x float], float, [3 x float], float, float, [3 x float], [3 x float], [3 x float] }
%struct.Viewport = type { i32, i32, i32, i32 }

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN14ViewParameters21UpdateRotationVectorsEv(ptr noundef nonnull align 4 dereferenceable(72)) #0 align 2

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN11ViewControl25ProcessRotationalMovementEPKf(ptr noundef nonnull align 4 dereferenceable(104) %0, ptr noundef %1) #0 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca float, align 4
  %6 = alloca float, align 4
  %7 = alloca float, align 4
  %8 = alloca float, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %9 = load ptr, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #3
  %10 = load ptr, ptr %4, align 8, !tbaa !5
  %11 = getelementptr inbounds float, ptr %10, i64 0
  %12 = load float, ptr %11, align 4, !tbaa !9
  store float %12, ptr %5, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #3
  %13 = load ptr, ptr %4, align 8, !tbaa !5
  %14 = getelementptr inbounds float, ptr %13, i64 1
  %15 = load float, ptr %14, align 4, !tbaa !9
  store float %15, ptr %6, align 4, !tbaa !9
  %16 = getelementptr inbounds %class.ViewControl, ptr %9, i32 0, i32 2
  %17 = load i8, ptr %16, align 4, !tbaa !11, !range !17, !noundef !18
  %18 = trunc i8 %17 to i1
  br i1 %18, label %19, label %22

19:                                               ; preds = %2
  %20 = load float, ptr %5, align 4, !tbaa !9
  %21 = fneg float %20
  store float %21, ptr %5, align 4, !tbaa !9
  br label %22

22:                                               ; preds = %19, %2
  %23 = load float, ptr %5, align 4, !tbaa !9
  %24 = getelementptr inbounds %class.ViewControl, ptr %9, i32 0, i32 3
  %25 = load float, ptr %24, align 4, !tbaa !19
  %26 = getelementptr inbounds %class.ViewControl, ptr %9, i32 0, i32 0
  %27 = getelementptr inbounds %struct.ViewParameters, ptr %26, i32 0, i32 3
  %28 = load float, ptr %27, align 4, !tbaa !20
  %29 = call float @llvm.fmuladd.f32(float %23, float %25, float %28)
  store float %29, ptr %27, align 4, !tbaa !20
  %30 = load float, ptr %6, align 4, !tbaa !9
  %31 = getelementptr inbounds %class.ViewControl, ptr %9, i32 0, i32 3
  %32 = load float, ptr %31, align 4, !tbaa !19
  %33 = getelementptr inbounds %class.ViewControl, ptr %9, i32 0, i32 0
  %34 = getelementptr inbounds %struct.ViewParameters, ptr %33, i32 0, i32 4
  %35 = load float, ptr %34, align 4, !tbaa !21
  %36 = fneg float %30
  %37 = call float @llvm.fmuladd.f32(float %36, float %32, float %35)
  store float %37, ptr %34, align 4, !tbaa !21
  %38 = getelementptr inbounds %class.ViewControl, ptr %9, i32 0, i32 0
  %39 = getelementptr inbounds %struct.ViewParameters, ptr %38, i32 0, i32 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #3
  store float -8.950000e+01, ptr %7, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #3
  store float 8.950000e+01, ptr %8, align 4, !tbaa !9
  %40 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt5clampIfERKT_S2_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %39, ptr noundef nonnull align 4 dereferenceable(4) %7, ptr noundef nonnull align 4 dereferenceable(4) %8)
  %41 = load float, ptr %40, align 4, !tbaa !9
  %42 = getelementptr inbounds %class.ViewControl, ptr %9, i32 0, i32 0
  %43 = getelementptr inbounds %struct.ViewParameters, ptr %42, i32 0, i32 4
  store float %41, ptr %43, align 4, !tbaa !21
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #3
  %44 = getelementptr inbounds %class.ViewControl, ptr %9, i32 0, i32 0
  call void @_ZN14ViewParameters21UpdateRotationVectorsEv(ptr noundef nonnull align 4 dereferenceable(72) %44)
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #3
  ret void
}

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #2

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt5clampIfERKT_S2_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #0

attributes #0 = { 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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, !16, i64 88}
!12 = !{!"_ZTS11ViewControl", !13, i64 0, !14, i64 72, !16, i64 88, !10, i64 92, !10, i64 96, !10, i64 100}
!13 = !{!"_ZTS14ViewParameters", !7, i64 0, !10, i64 12, !7, i64 16, !10, i64 28, !10, i64 32, !7, i64 36, !7, i64 48, !7, i64 60}
!14 = !{!"_ZTS8Viewport", !15, i64 0, !15, i64 4, !15, i64 8, !15, i64 12}
!15 = !{!"int", !7, i64 0}
!16 = !{!"bool", !7, i64 0}
!17 = !{i8 0, i8 2}
!18 = !{}
!19 = !{!12, !10, i64 92}
!20 = !{!12, !10, i64 28}
!21 = !{!12, !10, i64 32}


; 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 uwtable
declare dso_local void @_ZN14ViewParameters21UpdateRotationVectorsEv(ptr noundef nonnull align 4 dereferenceable(72)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN11ViewControl25ProcessRotationalMovementEPKf(ptr noundef nonnull align 4 dereferenceable(104) %0, ptr nocapture noundef readonly %1) local_unnamed_addr #0 align 2 {
  %3 = alloca float, align 4
  %4 = alloca float, align 4
  %5 = load float, ptr %1, align 4, !tbaa !5
  %6 = getelementptr inbounds i8, ptr %1, i64 4
  %7 = load float, ptr %6, align 4, !tbaa !5
  %8 = getelementptr inbounds i8, ptr %0, i64 88
  %9 = load i8, ptr %8, align 4, !tbaa !9, !range !15, !noundef !16
  %10 = trunc nuw i8 %9 to i1
  %11 = fneg float %5
  %.0 = select i1 %10, float %11, float %5
  %12 = getelementptr inbounds i8, ptr %0, i64 92
  %13 = load float, ptr %12, align 4, !tbaa !17
  %14 = getelementptr inbounds i8, ptr %0, i64 28
  %15 = getelementptr inbounds i8, ptr %0, i64 32
  %16 = fneg float %7
  %17 = load <2 x float>, ptr %14, align 4, !tbaa !5
  %18 = insertelement <2 x float> poison, float %.0, i64 0
  %19 = insertelement <2 x float> %18, float %16, i64 1
  %20 = insertelement <2 x float> poison, float %13, i64 0
  %21 = shufflevector <2 x float> %20, <2 x float> poison, <2 x i32> zeroinitializer
  %22 = tail call <2 x float> @llvm.fmuladd.v2f32(<2 x float> %19, <2 x float> %21, <2 x float> %17)
  store <2 x float> %22, ptr %14, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #3
  store float -8.950000e+01, ptr %3, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #3
  store float 8.950000e+01, ptr %4, align 4, !tbaa !5
  %23 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt5clampIfERKT_S2_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %15, ptr noundef nonnull align 4 dereferenceable(4) %3, ptr noundef nonnull align 4 dereferenceable(4) %4)
  %24 = load float, ptr %23, align 4, !tbaa !5
  store float %24, ptr %15, align 4, !tbaa !18
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #3
  call void @_ZN14ViewParameters21UpdateRotationVectorsEv(ptr noundef nonnull align 4 dereferenceable(72) %0)
  ret void
}

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt5clampIfERKT_S2_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #0

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <2 x float> @llvm.fmuladd.v2f32(<2 x float>, <2 x float>, <2 x float>) #2

attributes #0 = { 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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = !{!"float", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !14, i64 88}
!10 = !{!"_ZTS11ViewControl", !11, i64 0, !12, i64 72, !14, i64 88, !6, i64 92, !6, i64 96, !6, i64 100}
!11 = !{!"_ZTS14ViewParameters", !7, i64 0, !6, i64 12, !7, i64 16, !6, i64 28, !6, i64 32, !7, i64 36, !7, i64 48, !7, i64 60}
!12 = !{!"_ZTS8Viewport", !13, i64 0, !13, i64 4, !13, i64 8, !13, i64 12}
!13 = !{!"int", !7, i64 0}
!14 = !{!"bool", !7, i64 0}
!15 = !{i8 0, i8 2}
!16 = !{}
!17 = !{!10, !6, i64 92}
!18 = !{!10, !6, i64 32}


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