; LLVM IR from recp/cglm :: test/src (test_common)

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

@constinit = external hidden constant [4 x [4 x float]], align 16

; Function Attrs: nounwind uwtable
define dso_local void @test_rand_mat4(ptr noundef %0) #0 {
  %2 = alloca ptr, align 8
  %3 = alloca [4 x [4 x float]], align 16
  %4 = alloca [3 x float], align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.memset.p0.i64(ptr align 16 %3, i8 0, i64 64, i1 false)
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %3, ptr align 16 @constinit, i64 64, i1 false), !tbaa.struct !9
  %5 = getelementptr inbounds [4 x [4 x float]], ptr %3, i64 0, i64 0
  %6 = load ptr, ptr %2, align 8, !tbaa !5
  call void @glm_mat4_copy(ptr noundef %5, ptr noundef %6)
  %7 = call float @frand48()
  %8 = load ptr, ptr %2, align 8, !tbaa !5
  %9 = getelementptr inbounds [4 x float], ptr %8, i64 3
  %10 = getelementptr inbounds [4 x float], ptr %9, i64 0, i64 0
  store float %7, ptr %10, align 16, !tbaa !11
  %11 = call float @frand48()
  %12 = load ptr, ptr %2, align 8, !tbaa !5
  %13 = getelementptr inbounds [4 x float], ptr %12, i64 3
  %14 = getelementptr inbounds [4 x float], ptr %13, i64 0, i64 1
  store float %11, ptr %14, align 4, !tbaa !11
  %15 = call float @frand48()
  %16 = load ptr, ptr %2, align 8, !tbaa !5
  %17 = getelementptr inbounds [4 x float], ptr %16, i64 3
  %18 = getelementptr inbounds [4 x float], ptr %17, i64 0, i64 2
  store float %15, ptr %18, align 8, !tbaa !11
  %19 = load ptr, ptr %2, align 8, !tbaa !5
  %20 = call float @frand48()
  %21 = call float @frand48()
  store float %21, ptr %4, align 4, !tbaa !11
  %22 = getelementptr inbounds float, ptr %4, i64 1
  %23 = call float @frand48()
  store float %23, ptr %22, align 4, !tbaa !11
  %24 = getelementptr inbounds float, ptr %4, i64 2
  %25 = call float @frand48()
  store float %25, ptr %24, align 4, !tbaa !11
  %26 = getelementptr inbounds [3 x float], ptr %4, i64 0, i64 0
  call void @glm_rotate(ptr noundef %19, float noundef %20, ptr noundef %26)
  ret void
}

; Function Attrs: alwaysinline nounwind uwtable
declare hidden void @glm_mat4_copy(ptr noundef, ptr noundef) #1

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #3

; Function Attrs: alwaysinline nounwind uwtable
declare hidden float @frand48() #4

; Function Attrs: alwaysinline nounwind uwtable
declare hidden void @glm_rotate(ptr noundef, float noundef, ptr noundef) #4

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" }
attributes #1 = { alwaysinline nounwind uwtable "min-legal-vector-width"="128" "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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { alwaysinline 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/C++ TBAA"}
!9 = !{i64 0, i64 64, !10}
!10 = !{!7, !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"

@constinit = external hidden local_unnamed_addr constant [4 x [4 x float]], align 16

; Function Attrs: nounwind uwtable
define dso_local void @test_rand_mat4(ptr noundef %0) local_unnamed_addr #0 {
  %2 = alloca [4 x [4 x float]], align 16
  %3 = alloca [3 x float], align 4
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(64) %2, ptr noundef nonnull align 16 dereferenceable(64) @constinit, i64 64, i1 false), !tbaa.struct !5
  call void @glm_mat4_copy(ptr noundef nonnull %2, ptr noundef %0)
  %4 = call float @frand48()
  %5 = getelementptr inbounds i8, ptr %0, i64 48
  store float %4, ptr %5, align 16, !tbaa !9
  %6 = call float @frand48()
  %7 = getelementptr inbounds i8, ptr %0, i64 52
  store float %6, ptr %7, align 4, !tbaa !9
  %8 = call float @frand48()
  %9 = getelementptr inbounds i8, ptr %0, i64 56
  store float %8, ptr %9, align 8, !tbaa !9
  %10 = call float @frand48()
  %11 = call float @frand48()
  store float %11, ptr %3, align 4, !tbaa !9
  %12 = getelementptr inbounds i8, ptr %3, i64 4
  %13 = call float @frand48()
  store float %13, ptr %12, align 4, !tbaa !9
  %14 = getelementptr inbounds i8, ptr %3, i64 8
  %15 = call float @frand48()
  store float %15, ptr %14, align 4, !tbaa !9
  call void @glm_rotate(ptr noundef %0, float noundef %10, ptr noundef nonnull %3)
  ret void
}

; Function Attrs: alwaysinline nounwind uwtable
declare hidden void @glm_mat4_copy(ptr noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #2

; Function Attrs: alwaysinline nounwind uwtable
declare hidden float @frand48() local_unnamed_addr #3

; Function Attrs: alwaysinline nounwind uwtable
declare hidden void @glm_rotate(ptr noundef, float noundef, ptr noundef) local_unnamed_addr #3

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" }
attributes #1 = { alwaysinline nounwind uwtable "min-legal-vector-width"="128" "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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { alwaysinline 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 = !{i64 0, i64 64, !6}
!6 = !{!7, !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"float", !7, i64 0}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,MemCpyOptPass,SROAPass