; LLVM IR from ThePhysicsGuys/Physics3D :: graphics/renderer.ll (ZN3P3D8Graphics8Renderer8viewportERKNS_6VectorIiLm2EEES5_)

; 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"

%"struct.P3D::Graphics::Renderer::RenderState" = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, [4 x i32], [2 x i32], i8, i8, i8, i8, i8 }
%"struct.P3D::Vector" = type { %union.anon }
%union.anon = type { [2 x i32] }
%struct.anon = type { i32, i32 }

@_ZN3P3D8Graphics8Renderer7currentE = external dso_local global %"struct.P3D::Graphics::Renderer::RenderState", align 4

declare void @glViewport(i32 noundef, i32 noundef, i32 noundef, i32 noundef) #0

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3P3D8Graphics8Renderer8viewportERKNS_6VectorIiLm2EEES5_(ptr noundef nonnull align 4 dereferenceable(8) %0, ptr noundef nonnull align 4 dereferenceable(8) %1) #1 {
  %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, !tbaa !5
  %6 = getelementptr inbounds %"struct.P3D::Vector", ptr %5, i32 0, i32 0
  %7 = getelementptr inbounds %struct.anon, ptr %6, i32 0, i32 0
  %8 = load i32, ptr %7, align 4, !tbaa !9
  store i32 %8, ptr getelementptr inbounds (%"struct.P3D::Graphics::Renderer::RenderState", ptr @_ZN3P3D8Graphics8Renderer7currentE, i32 0, i32 9), align 4, !tbaa !10
  %9 = load ptr, ptr %3, align 8, !tbaa !5
  %10 = getelementptr inbounds %"struct.P3D::Vector", ptr %9, i32 0, i32 0
  %11 = getelementptr inbounds %struct.anon, ptr %10, i32 0, i32 1
  %12 = load i32, ptr %11, align 4, !tbaa !9
  store i32 %12, ptr getelementptr inbounds ([4 x i32], ptr getelementptr inbounds (%"struct.P3D::Graphics::Renderer::RenderState", ptr @_ZN3P3D8Graphics8Renderer7currentE, i32 0, i32 9), i64 0, i64 1), align 4, !tbaa !10
  %13 = load ptr, ptr %4, align 8, !tbaa !5
  %14 = getelementptr inbounds %"struct.P3D::Vector", ptr %13, i32 0, i32 0
  %15 = getelementptr inbounds %struct.anon, ptr %14, i32 0, i32 0
  %16 = load i32, ptr %15, align 4, !tbaa !9
  store i32 %16, ptr getelementptr inbounds ([4 x i32], ptr getelementptr inbounds (%"struct.P3D::Graphics::Renderer::RenderState", ptr @_ZN3P3D8Graphics8Renderer7currentE, i32 0, i32 9), i64 0, i64 2), align 4, !tbaa !10
  %17 = load ptr, ptr %4, align 8, !tbaa !5
  %18 = getelementptr inbounds %"struct.P3D::Vector", ptr %17, i32 0, i32 0
  %19 = getelementptr inbounds %struct.anon, ptr %18, i32 0, i32 1
  %20 = load i32, ptr %19, align 4, !tbaa !9
  store i32 %20, ptr getelementptr inbounds ([4 x i32], ptr getelementptr inbounds (%"struct.P3D::Graphics::Renderer::RenderState", ptr @_ZN3P3D8Graphics8Renderer7currentE, i32 0, i32 9), i64 0, i64 3), align 4, !tbaa !10
  %21 = load ptr, ptr %3, align 8, !tbaa !5
  %22 = getelementptr inbounds %"struct.P3D::Vector", ptr %21, i32 0, i32 0
  %23 = getelementptr inbounds %struct.anon, ptr %22, i32 0, i32 0
  %24 = load i32, ptr %23, align 4, !tbaa !9
  %25 = load ptr, ptr %3, align 8, !tbaa !5
  %26 = getelementptr inbounds %"struct.P3D::Vector", ptr %25, i32 0, i32 0
  %27 = getelementptr inbounds %struct.anon, ptr %26, i32 0, i32 1
  %28 = load i32, ptr %27, align 4, !tbaa !9
  %29 = load ptr, ptr %4, align 8, !tbaa !5
  %30 = getelementptr inbounds %"struct.P3D::Vector", ptr %29, i32 0, i32 0
  %31 = getelementptr inbounds %struct.anon, ptr %30, i32 0, i32 0
  %32 = load i32, ptr %31, align 4, !tbaa !9
  %33 = load ptr, ptr %4, align 8, !tbaa !5
  %34 = getelementptr inbounds %"struct.P3D::Vector", ptr %33, i32 0, i32 0
  %35 = getelementptr inbounds %struct.anon, ptr %34, i32 0, i32 1
  %36 = load i32, ptr %35, align 4, !tbaa !9
  call void @glViewport(i32 noundef %24, i32 noundef %28, i32 noundef %32, i32 noundef %36)
  ret void
}

attributes #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" }

!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 = !{!7, !7, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"int", !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"

%"struct.P3D::Graphics::Renderer::RenderState" = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, [4 x i32], [2 x i32], i8, i8, i8, i8, i8 }

@_ZN3P3D8Graphics8Renderer7currentE = external dso_local local_unnamed_addr global %"struct.P3D::Graphics::Renderer::RenderState", align 4

declare void @glViewport(i32 noundef, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3P3D8Graphics8Renderer8viewportERKNS_6VectorIiLm2EEES5_(ptr nocapture noundef nonnull readonly align 4 dereferenceable(8) %0, ptr nocapture noundef nonnull readonly align 4 dereferenceable(8) %1) local_unnamed_addr #1 {
  %3 = load i32, ptr %0, align 4, !tbaa !5
  store i32 %3, ptr getelementptr inbounds (i8, ptr @_ZN3P3D8Graphics8Renderer7currentE, i64 36), align 4, !tbaa !8
  %4 = getelementptr inbounds i8, ptr %0, i64 4
  %5 = load i32, ptr %4, align 4, !tbaa !5
  store i32 %5, ptr getelementptr inbounds (i8, ptr @_ZN3P3D8Graphics8Renderer7currentE, i64 40), align 4, !tbaa !8
  %6 = load i32, ptr %1, align 4, !tbaa !5
  store i32 %6, ptr getelementptr inbounds (i8, ptr @_ZN3P3D8Graphics8Renderer7currentE, i64 44), align 4, !tbaa !8
  %7 = getelementptr inbounds i8, ptr %1, i64 4
  %8 = load i32, ptr %7, align 4, !tbaa !5
  store i32 %8, ptr getelementptr inbounds (i8, ptr @_ZN3P3D8Graphics8Renderer7currentE, i64 48), align 4, !tbaa !8
  %9 = load i32, ptr %0, align 4, !tbaa !5
  %10 = load i32, ptr %4, align 4, !tbaa !5
  %11 = load i32, ptr %1, align 4, !tbaa !5
  tail call void @glViewport(i32 noundef %9, i32 noundef %10, i32 noundef %11, i32 noundef %8)
  ret void
}

attributes #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" }

!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, !9, i64 0}
!9 = !{!"int", !6, i64 0}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,TailCallElimPass