; 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 void @_ZN7linmathL9vec3_copyEPfPKf(ptr noundef, ptr noundef) #0

; 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
declare dso_local void @_ZN11ViewControl13GetViewMatrixEPA4_f(ptr noundef nonnull align 4 dereferenceable(104), ptr noundef) #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN11ViewControl20GetPerspectiveMatrixEPA4_f(ptr noundef nonnull align 4 dereferenceable(104), ptr noundef) #2 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN11ViewControl19UnprojectFromScreenEPfPKff(ptr noundef nonnull align 4 dereferenceable(104) %0, ptr noundef %1, ptr noundef %2, float noundef %3) #2 align 2 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca float, align 4
  %9 = alloca [4 x float], align 16
  %10 = alloca [4 x float], align 16
  %11 = alloca [4 x [4 x float]], align 16
  %12 = alloca [4 x [4 x float]], align 16
  %13 = alloca [4 x [4 x float]], align 16
  %14 = alloca [4 x [4 x float]], align 16
  %15 = alloca [4 x float], align 16
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store ptr %2, ptr %7, align 8, !tbaa !5
  store float %3, ptr %8, align 4, !tbaa !9
  %16 = load ptr, ptr %5, align 8
  call void @llvm.lifetime.start.p0(i64 16, ptr %9) #5
  %17 = load ptr, ptr %7, align 8, !tbaa !5
  %18 = getelementptr inbounds float, ptr %17, i64 0
  %19 = load float, ptr %18, align 4, !tbaa !9
  %20 = fsub float %19, 5.000000e-01
  %21 = getelementptr inbounds %class.ViewControl, ptr %16, i32 0, i32 1
  %22 = getelementptr inbounds %struct.Viewport, ptr %21, i32 0, i32 0
  %23 = load i32, ptr %22, align 4, !tbaa !11
  %24 = sitofp i32 %23 to float
  %25 = fsub float %20, %24
  %26 = getelementptr inbounds %class.ViewControl, ptr %16, i32 0, i32 1
  %27 = getelementptr inbounds %struct.Viewport, ptr %26, i32 0, i32 2
  %28 = load i32, ptr %27, align 4, !tbaa !17
  %29 = sitofp i32 %28 to float
  %30 = fdiv float %25, %29
  %31 = call float @llvm.fmuladd.f32(float %30, float 2.000000e+00, float -1.000000e+00)
  %32 = getelementptr inbounds [4 x float], ptr %9, i64 0, i64 0
  store float %31, ptr %32, align 16, !tbaa !9
  %33 = load ptr, ptr %7, align 8, !tbaa !5
  %34 = getelementptr inbounds float, ptr %33, i64 1
  %35 = load float, ptr %34, align 4, !tbaa !9
  %36 = fsub float %35, 5.000000e-01
  %37 = getelementptr inbounds %class.ViewControl, ptr %16, i32 0, i32 1
  %38 = getelementptr inbounds %struct.Viewport, ptr %37, i32 0, i32 1
  %39 = load i32, ptr %38, align 4, !tbaa !18
  %40 = sitofp i32 %39 to float
  %41 = fsub float %36, %40
  %42 = getelementptr inbounds %class.ViewControl, ptr %16, i32 0, i32 1
  %43 = getelementptr inbounds %struct.Viewport, ptr %42, i32 0, i32 3
  %44 = load i32, ptr %43, align 4, !tbaa !19
  %45 = sitofp i32 %44 to float
  %46 = fdiv float %41, %45
  %47 = call float @llvm.fmuladd.f32(float %46, float 2.000000e+00, float -1.000000e+00)
  %48 = getelementptr inbounds [4 x float], ptr %9, i64 0, i64 1
  store float %47, ptr %48, align 4, !tbaa !9
  %49 = getelementptr inbounds [4 x float], ptr %9, i64 0, i64 2
  store float 0.000000e+00, ptr %49, align 8, !tbaa !9
  %50 = getelementptr inbounds [4 x float], ptr %9, i64 0, i64 3
  store float 1.000000e+00, ptr %50, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 16, ptr %10) #5
  %51 = getelementptr inbounds [4 x float], ptr %10, i64 0, i64 0
  %52 = getelementptr inbounds [4 x float], ptr %9, i64 0, i64 0
  %53 = load float, ptr %8, align 4, !tbaa !9
  call void @_ZN7linmathL10vec4_scaleEPfPKff(ptr noundef %51, ptr noundef %52, float noundef %53)
  call void @llvm.lifetime.start.p0(i64 64, ptr %11) #5
  %54 = getelementptr inbounds [4 x [4 x float]], ptr %11, i64 0, i64 0
  call void @_ZN11ViewControl20GetPerspectiveMatrixEPA4_f(ptr noundef nonnull align 4 dereferenceable(104) %16, ptr noundef %54)
  call void @llvm.lifetime.start.p0(i64 64, ptr %12) #5
  %55 = getelementptr inbounds [4 x [4 x float]], ptr %12, i64 0, i64 0
  call void @_ZN11ViewControl13GetViewMatrixEPA4_f(ptr noundef nonnull align 4 dereferenceable(104) %16, ptr noundef %55)
  call void @llvm.lifetime.start.p0(i64 64, ptr %13) #5
  %56 = getelementptr inbounds [4 x [4 x float]], ptr %13, i64 0, i64 0
  %57 = getelementptr inbounds [4 x [4 x float]], ptr %11, i64 0, i64 0
  %58 = getelementptr inbounds [4 x [4 x float]], ptr %12, i64 0, i64 0
  call void @_ZN7linmathL10mat4x4_mulEPA4_fS1_S1_(ptr noundef %56, ptr noundef %57, ptr noundef %58)
  call void @llvm.lifetime.start.p0(i64 64, ptr %14) #5
  %59 = getelementptr inbounds [4 x [4 x float]], ptr %14, i64 0, i64 0
  %60 = getelementptr inbounds [4 x [4 x float]], ptr %13, i64 0, i64 0
  call void @_ZN7linmathL13mat4x4_invertEPA4_fS1_(ptr noundef %59, ptr noundef %60)
  call void @llvm.lifetime.start.p0(i64 16, ptr %15) #5
  %61 = getelementptr inbounds [4 x float], ptr %15, i64 0, i64 0
  %62 = getelementptr inbounds [4 x [4 x float]], ptr %14, i64 0, i64 0
  %63 = getelementptr inbounds [4 x float], ptr %10, i64 0, i64 0
  call void @_ZN7linmathL15mat4x4_mul_vec4EPfPA4_fS0_(ptr noundef %61, ptr noundef %62, ptr noundef %63)
  %64 = load ptr, ptr %6, align 8, !tbaa !5
  %65 = getelementptr inbounds [4 x float], ptr %15, i64 0, i64 0
  call void @_ZN7linmathL9vec3_copyEPfPKf(ptr noundef %64, ptr noundef %65)
  call void @llvm.lifetime.end.p0(i64 16, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 64, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 64, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 64, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 64, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr %9) #5
  ret void
}

; Function Attrs: inlinehint mustprogress uwtable
declare hidden void @_ZN7linmathL10mat4x4_mulEPA4_fS1_S1_(ptr noundef, ptr noundef, ptr noundef) #4

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden void @_ZN7linmathL15mat4x4_mul_vec4EPfPA4_fS0_(ptr noundef, ptr noundef, ptr noundef) #0

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden void @_ZN7linmathL10vec4_scaleEPfPKff(ptr noundef, ptr noundef, float noundef) #0

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden void @_ZN7linmathL13mat4x4_invertEPA4_fS1_(ptr noundef, ptr noundef) #0

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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { 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 #5 = { 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, !15, i64 72}
!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 = !{!12, !15, i64 80}
!18 = !{!12, !15, i64 76}
!19 = !{!12, !15, i64 84}


; 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 void @_ZN7linmathL9vec3_copyEPfPKf(ptr noundef, ptr noundef) local_unnamed_addr #0

; 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
declare dso_local void @_ZN11ViewControl13GetViewMatrixEPA4_f(ptr noundef nonnull align 4 dereferenceable(104), ptr noundef) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN11ViewControl20GetPerspectiveMatrixEPA4_f(ptr noundef nonnull align 4 dereferenceable(104), ptr noundef) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN11ViewControl19UnprojectFromScreenEPfPKff(ptr noundef nonnull align 4 dereferenceable(104) %0, ptr noundef %1, ptr nocapture noundef readonly %2, float noundef %3) local_unnamed_addr #2 align 2 {
  %5 = alloca [4 x float], align 16
  %6 = alloca [4 x float], align 16
  %7 = alloca [4 x [4 x float]], align 16
  %8 = alloca [4 x [4 x float]], align 16
  %9 = alloca [4 x [4 x float]], align 16
  %10 = alloca [4 x [4 x float]], align 16
  %11 = alloca [4 x float], align 16
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %5) #5
  %12 = getelementptr inbounds i8, ptr %0, i64 72
  %13 = getelementptr inbounds i8, ptr %0, i64 80
  %14 = load <2 x float>, ptr %2, align 4, !tbaa !5
  %15 = fadd <2 x float> %14, <float -5.000000e-01, float -5.000000e-01>
  %16 = load <2 x i32>, ptr %12, align 4, !tbaa !9
  %17 = sitofp <2 x i32> %16 to <2 x float>
  %18 = fsub <2 x float> %15, %17
  %19 = load <2 x i32>, ptr %13, align 4, !tbaa !9
  %20 = sitofp <2 x i32> %19 to <2 x float>
  %21 = fdiv <2 x float> %18, %20
  %22 = tail call <2 x float> @llvm.fmuladd.v2f32(<2 x float> %21, <2 x float> <float 2.000000e+00, float 2.000000e+00>, <2 x float> <float -1.000000e+00, float -1.000000e+00>)
  store <2 x float> %22, ptr %5, align 16, !tbaa !5
  %23 = getelementptr inbounds i8, ptr %5, i64 8
  store <2 x float> <float 0.000000e+00, float 1.000000e+00>, ptr %23, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %6) #5
  call void @_ZN7linmathL10vec4_scaleEPfPKff(ptr noundef nonnull %6, ptr noundef nonnull %5, float noundef %3)
  call void @llvm.lifetime.start.p0(i64 64, ptr nonnull %7) #5
  call void @_ZN11ViewControl20GetPerspectiveMatrixEPA4_f(ptr noundef nonnull align 4 dereferenceable(104) %0, ptr noundef nonnull %7)
  call void @llvm.lifetime.start.p0(i64 64, ptr nonnull %8) #5
  call void @_ZN11ViewControl13GetViewMatrixEPA4_f(ptr noundef nonnull align 4 dereferenceable(104) %0, ptr noundef nonnull %8)
  call void @llvm.lifetime.start.p0(i64 64, ptr nonnull %9) #5
  call void @_ZN7linmathL10mat4x4_mulEPA4_fS1_S1_(ptr noundef nonnull %9, ptr noundef nonnull %7, ptr noundef nonnull %8)
  call void @llvm.lifetime.start.p0(i64 64, ptr nonnull %10) #5
  call void @_ZN7linmathL13mat4x4_invertEPA4_fS1_(ptr noundef nonnull %10, ptr noundef nonnull %9)
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %11) #5
  call void @_ZN7linmathL15mat4x4_mul_vec4EPfPA4_fS0_(ptr noundef nonnull %11, ptr noundef nonnull %10, ptr noundef nonnull %6)
  call void @_ZN7linmathL9vec3_copyEPfPKf(ptr noundef %1, ptr noundef nonnull %11)
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %11) #5
  call void @llvm.lifetime.end.p0(i64 64, ptr nonnull %10) #5
  call void @llvm.lifetime.end.p0(i64 64, ptr nonnull %9) #5
  call void @llvm.lifetime.end.p0(i64 64, ptr nonnull %8) #5
  call void @llvm.lifetime.end.p0(i64 64, ptr nonnull %7) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %6) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %5) #5
  ret void
}

; Function Attrs: inlinehint mustprogress uwtable
declare hidden void @_ZN7linmathL10mat4x4_mulEPA4_fS1_S1_(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #3

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden void @_ZN7linmathL15mat4x4_mul_vec4EPfPA4_fS0_(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden void @_ZN7linmathL10vec4_scaleEPfPKff(ptr noundef, ptr noundef, float noundef) local_unnamed_addr #0

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden void @_ZN7linmathL13mat4x4_invertEPA4_fS1_(ptr noundef, ptr noundef) 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>) #4

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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { 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, !10, i64 0}
!10 = !{!"int", !7, i64 0}


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