; LLVM IR from Eydcao/Yan-CG-SnowSim :: src/camera.ll (ZN6Camera11SetViewportEiiii)

; 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.Camera = type { [2 x i32], [2 x i32], i32, [12 x i8], %"class.Eigen::Matrix", %"class.Eigen::Matrix", [2 x float], [4 x i32], %"class.Eigen::Matrix.3", %"class.Eigen::Matrix.3", float, float, [8 x i8] }
%"class.Eigen::Matrix" = type { %"class.Eigen::PlainObjectBase" }
%"class.Eigen::PlainObjectBase" = type { %"class.Eigen::DenseStorage" }
%"class.Eigen::DenseStorage" = type { %"struct.Eigen::internal::plain_array" }
%"struct.Eigen::internal::plain_array" = type { [16 x float] }
%"class.Eigen::Matrix.3" = type { %"class.Eigen::PlainObjectBase.4" }
%"class.Eigen::PlainObjectBase.4" = type { %"class.Eigen::DenseStorage.11" }
%"class.Eigen::DenseStorage.11" = type { %"struct.Eigen::internal::plain_array.12" }
%"struct.Eigen::internal::plain_array.12" = type { [3 x float] }

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN6Camera11SetViewportEiiii(ptr noundef nonnull align 16 dereferenceable(216) %0, i32 noundef %1, i32 noundef %2, i32 noundef %3, i32 noundef %4) #0 align 2 {
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  store ptr %0, ptr %6, align 8, !tbaa !5
  store i32 %1, ptr %7, align 4, !tbaa !9
  store i32 %2, ptr %8, align 4, !tbaa !9
  store i32 %3, ptr %9, align 4, !tbaa !9
  store i32 %4, ptr %10, align 4, !tbaa !9
  %11 = load ptr, ptr %6, align 8
  %12 = load i32, ptr %7, align 4, !tbaa !9
  %13 = getelementptr inbounds %class.Camera, ptr %11, i32 0, i32 7
  %14 = getelementptr inbounds [4 x i32], ptr %13, i64 0, i64 0
  store i32 %12, ptr %14, align 8, !tbaa !9
  %15 = load i32, ptr %8, align 4, !tbaa !9
  %16 = getelementptr inbounds %class.Camera, ptr %11, i32 0, i32 7
  %17 = getelementptr inbounds [4 x i32], ptr %16, i64 0, i64 1
  store i32 %15, ptr %17, align 4, !tbaa !9
  %18 = load i32, ptr %9, align 4, !tbaa !9
  %19 = getelementptr inbounds %class.Camera, ptr %11, i32 0, i32 7
  %20 = getelementptr inbounds [4 x i32], ptr %19, i64 0, i64 2
  store i32 %18, ptr %20, align 8, !tbaa !9
  %21 = load i32, ptr %10, align 4, !tbaa !9
  %22 = getelementptr inbounds %class.Camera, ptr %11, i32 0, i32 7
  %23 = getelementptr inbounds [4 x i32], ptr %22, i64 0, i64 3
  store i32 %21, ptr %23, align 4, !tbaa !9
  %24 = load i32, ptr %9, align 4, !tbaa !9
  %25 = sitofp i32 %24 to float
  %26 = load i32, ptr %10, align 4, !tbaa !9
  %27 = sitofp i32 %26 to float
  %28 = fdiv float %25, %27
  %29 = getelementptr inbounds %class.Camera, ptr %11, i32 0, i32 6
  %30 = getelementptr inbounds [2 x float], ptr %29, i64 0, i64 1
  store float %28, ptr %30, align 4, !tbaa !11
  ret void
}

attributes #0 = { 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, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"float", !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: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write) uwtable
define dso_local void @_ZN6Camera11SetViewportEiiii(ptr nocapture noundef nonnull writeonly align 16 dereferenceable(216) %0, i32 noundef %1, i32 noundef %2, i32 noundef %3, i32 noundef %4) local_unnamed_addr #0 align 2 {
  %6 = getelementptr inbounds i8, ptr %0, i64 168
  store i32 %1, ptr %6, align 8, !tbaa !5
  %7 = getelementptr inbounds i8, ptr %0, i64 172
  store i32 %2, ptr %7, align 4, !tbaa !5
  %8 = getelementptr inbounds i8, ptr %0, i64 176
  store i32 %3, ptr %8, align 16, !tbaa !5
  %9 = getelementptr inbounds i8, ptr %0, i64 180
  store i32 %4, ptr %9, align 4, !tbaa !5
  %10 = sitofp i32 %3 to float
  %11 = sitofp i32 %4 to float
  %12 = fdiv float %10, %11
  %13 = getelementptr inbounds i8, ptr %0, i64 164
  store float %12, ptr %13, align 4, !tbaa !9
  ret void
}

attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write) 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, !10, i64 0}
!10 = !{!"float", !7, i64 0}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferAlignmentPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass