; 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: inlinehint mustprogress nounwind uwtable
declare hidden noundef float @_ZL16DegreesToRadiansf(float noundef) #0

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN11ViewControl20GetPerspectiveMatrixEPA4_f(ptr noundef nonnull align 4 dereferenceable(104) %0, ptr noundef %1) #1 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %5 = load ptr, ptr %3, align 8
  %6 = load ptr, ptr %4, align 8, !tbaa !5
  %7 = call noundef float @_ZN11ViewControl26PerspectiveFOVForRenderingEv(ptr noundef nonnull align 4 dereferenceable(104) %5)
  %8 = call noundef float @_ZL16DegreesToRadiansf(float noundef %7)
  %9 = getelementptr inbounds %class.ViewControl, ptr %5, i32 0, i32 1
  %10 = getelementptr inbounds %struct.Viewport, ptr %9, i32 0, i32 2
  %11 = load i32, ptr %10, align 4, !tbaa !9
  %12 = sitofp i32 %11 to float
  %13 = getelementptr inbounds %class.ViewControl, ptr %5, i32 0, i32 1
  %14 = getelementptr inbounds %struct.Viewport, ptr %13, i32 0, i32 3
  %15 = load i32, ptr %14, align 4, !tbaa !16
  %16 = sitofp i32 %15 to float
  %17 = fdiv float %12, %16
  call void @_ZN7linmathL18mat4x4_perspectiveEPA4_fffff(ptr noundef %6, float noundef %8, float noundef %17, float noundef 0x3FB99999A0000000, float noundef 1.500000e+02)
  %18 = getelementptr inbounds %class.ViewControl, ptr %5, i32 0, i32 2
  %19 = load i8, ptr %18, align 4, !tbaa !17, !range !18, !noundef !19
  %20 = trunc i8 %19 to i1
  br i1 %20, label %21, label %30

21:                                               ; preds = %2
  %22 = load ptr, ptr %4, align 8, !tbaa !5
  %23 = getelementptr inbounds [4 x float], ptr %22, i64 0
  %24 = getelementptr inbounds [4 x float], ptr %23, i64 0, i64 0
  %25 = load float, ptr %24, align 4, !tbaa !20
  %26 = fneg float %25
  %27 = load ptr, ptr %4, align 8, !tbaa !5
  %28 = getelementptr inbounds [4 x float], ptr %27, i64 0
  %29 = getelementptr inbounds [4 x float], ptr %28, i64 0, i64 0
  store float %26, ptr %29, align 4, !tbaa !20
  br label %30

30:                                               ; preds = %21, %2
  ret void
}

; Function Attrs: inlinehint mustprogress uwtable
declare hidden void @_ZN7linmathL18mat4x4_perspectiveEPA4_fffff(ptr noundef, float noundef, float noundef, float noundef, float noundef) #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef float @_ZN11ViewControl26PerspectiveFOVForRenderingEv(ptr noundef nonnull align 4 dereferenceable(104)) #3 align 2

attributes #0 = { 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 #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 = { 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 #3 = { 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" }

!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, !14, i64 80}
!10 = !{!"_ZTS11ViewControl", !11, i64 0, !13, i64 72, !15, i64 88, !12, i64 92, !12, i64 96, !12, i64 100}
!11 = !{!"_ZTS14ViewParameters", !7, i64 0, !12, i64 12, !7, i64 16, !12, i64 28, !12, i64 32, !7, i64 36, !7, i64 48, !7, i64 60}
!12 = !{!"float", !7, i64 0}
!13 = !{!"_ZTS8Viewport", !14, i64 0, !14, i64 4, !14, i64 8, !14, i64 12}
!14 = !{!"int", !7, i64 0}
!15 = !{!"bool", !7, i64 0}
!16 = !{!10, !14, i64 84}
!17 = !{!10, !15, i64 88}
!18 = !{i8 0, i8 2}
!19 = !{}
!20 = !{!12, !12, 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 nounwind uwtable
declare hidden noundef float @_ZL16DegreesToRadiansf(float noundef) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN11ViewControl20GetPerspectiveMatrixEPA4_f(ptr noundef nonnull align 4 dereferenceable(104) %0, ptr noundef %1) local_unnamed_addr #1 align 2 {
  %3 = tail call noundef float @_ZN11ViewControl26PerspectiveFOVForRenderingEv(ptr noundef nonnull align 4 dereferenceable(104) %0)
  %4 = tail call noundef float @_ZL16DegreesToRadiansf(float noundef %3)
  %5 = getelementptr inbounds i8, ptr %0, i64 80
  %6 = load <2 x i32>, ptr %5, align 4, !tbaa !5
  %7 = sitofp <2 x i32> %6 to <2 x float>
  %8 = extractelement <2 x float> %7, i64 0
  %9 = extractelement <2 x float> %7, i64 1
  %10 = fdiv float %8, %9
  tail call void @_ZN7linmathL18mat4x4_perspectiveEPA4_fffff(ptr noundef %1, float noundef %4, float noundef %10, float noundef 0x3FB99999A0000000, float noundef 1.500000e+02)
  %11 = getelementptr inbounds i8, ptr %0, i64 88
  %12 = load i8, ptr %11, align 4, !tbaa !9, !range !15, !noundef !16
  %13 = trunc nuw i8 %12 to i1
  br i1 %13, label %14, label %17

14:                                               ; preds = %2
  %15 = load float, ptr %1, align 4, !tbaa !17
  %16 = fneg float %15
  store float %16, ptr %1, align 4, !tbaa !17
  br label %17

17:                                               ; preds = %14, %2
  ret void
}

; Function Attrs: inlinehint mustprogress uwtable
declare hidden void @_ZN7linmathL18mat4x4_perspectiveEPA4_fffff(ptr noundef, float noundef, float noundef, float noundef, float noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef float @_ZN11ViewControl26PerspectiveFOVForRenderingEv(ptr noundef nonnull align 4 dereferenceable(104)) local_unnamed_addr #3 align 2

attributes #0 = { 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 #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 = { 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 #3 = { 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" }

!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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !14, i64 88}
!10 = !{!"_ZTS11ViewControl", !11, i64 0, !13, i64 72, !14, i64 88, !12, i64 92, !12, i64 96, !12, i64 100}
!11 = !{!"_ZTS14ViewParameters", !7, i64 0, !12, i64 12, !7, i64 16, !12, i64 28, !12, i64 32, !7, i64 36, !7, i64 48, !7, i64 60}
!12 = !{!"float", !7, i64 0}
!13 = !{!"_ZTS8Viewport", !6, i64 0, !6, i64 4, !6, i64 8, !6, i64 12}
!14 = !{!"bool", !7, i64 0}
!15 = !{i8 0, i8 2}
!16 = !{}
!17 = !{!12, !12, i64 0}


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