; LLVM IR from Stephane-D/SGDK :: src (maths3D)

; 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.Context3D = type { %struct.Vect2D_u16, i16, %struct.Vect3D_f16, i16 }
%struct.Vect2D_u16 = type { i16, i16 }
%struct.Vect3D_f16 = type { i16, i16, i16 }

@context3D = external dso_local global %struct.Context3D, align 2

; Function Attrs: nounwind uwtable
define dso_local void @M3D_reset() #0 {
  store i16 0, ptr getelementptr inbounds (%struct.Context3D, ptr @context3D, i32 0, i32 3), align 2, !tbaa !5
  call void @M3D_setViewport(i16 noundef zeroext 256, i16 noundef zeroext 160)
  store i16 1280, ptr getelementptr inbounds (%struct.Context3D, ptr @context3D, i32 0, i32 1), align 2, !tbaa !12
  store i16 64, ptr getelementptr inbounds (%struct.Context3D, ptr @context3D, i32 0, i32 2), align 2, !tbaa !13
  store i16 0, ptr getelementptr inbounds (%struct.Vect3D_f16, ptr getelementptr inbounds (%struct.Context3D, ptr @context3D, i32 0, i32 2), i32 0, i32 1), align 2, !tbaa !14
  store i16 0, ptr getelementptr inbounds (%struct.Vect3D_f16, ptr getelementptr inbounds (%struct.Context3D, ptr @context3D, i32 0, i32 2), i32 0, i32 2), align 2, !tbaa !15
  ret void
}

; Function Attrs: nounwind uwtable
declare dso_local void @M3D_setViewport(i16 noundef zeroext, i16 noundef zeroext) #0

attributes #0 = { 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, !8, i64 12}
!6 = !{!"", !7, i64 0, !8, i64 4, !11, i64 6, !8, i64 12}
!7 = !{!"", !8, i64 0, !8, i64 2}
!8 = !{!"short", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
!11 = !{!"", !8, i64 0, !8, i64 2, !8, i64 4}
!12 = !{!6, !8, i64 4}
!13 = !{!6, !8, i64 6}
!14 = !{!6, !8, i64 8}
!15 = !{!6, !8, i64 10}


; 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.Context3D = type { %struct.Vect2D_u16, i16, %struct.Vect3D_f16, i16 }
%struct.Vect2D_u16 = type { i16, i16 }
%struct.Vect3D_f16 = type { i16, i16, i16 }

@context3D = external dso_local local_unnamed_addr global %struct.Context3D, align 2

; Function Attrs: nounwind uwtable
define dso_local void @M3D_reset() local_unnamed_addr #0 {
  store i16 0, ptr getelementptr inbounds (i8, ptr @context3D, i64 12), align 2, !tbaa !5
  tail call void @M3D_setViewport(i16 noundef zeroext 256, i16 noundef zeroext 160)
  store <4 x i16> <i16 1280, i16 64, i16 0, i16 0>, ptr getelementptr inbounds (i8, ptr @context3D, i64 4), align 2, !tbaa !12
  ret void
}

; Function Attrs: nounwind uwtable
declare dso_local void @M3D_setViewport(i16 noundef zeroext, i16 noundef zeroext) local_unnamed_addr #0

attributes #0 = { 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, !8, i64 12}
!6 = !{!"", !7, i64 0, !8, i64 4, !11, i64 6, !8, i64 12}
!7 = !{!"", !8, i64 0, !8, i64 2}
!8 = !{!"short", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
!11 = !{!"", !8, i64 0, !8, i64 2, !8, i64 4}
!12 = !{!8, !8, i64 0}


; Effective O3 passes: GlobalOptPass,InstCombinePass,SLPVectorizerPass,TailCallElimPass