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

; 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.test_status_t = type { ptr, i32 }

@stderr = external global ptr, align 8
@.str = external hidden unnamed_addr constant [94 x i8], align 1
@.str.671 = external hidden unnamed_addr constant [64 x i8], align 1
@.str.687 = external hidden unnamed_addr constant [20 x i8], align 1

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: alwaysinline nounwind uwtable
declare hidden zeroext i1 @test_eq(float noundef, float noundef) #1

; Function Attrs: nounwind
declare i32 @fprintf(ptr noundef, ptr noundef, ...) #2

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

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

declare void @test_rand_mat3(ptr noundef) #4

; Function Attrs: nounwind uwtable
define dso_local { ptr, i32 } @test_glm_mat3_det() #5 {
  %1 = alloca %struct.test_status_t, align 8
  %2 = alloca [3 x [3 x float]], align 16
  %3 = alloca float, align 4
  %4 = alloca float, align 4
  %5 = alloca float, align 4
  %6 = alloca float, align 4
  %7 = alloca float, align 4
  %8 = alloca float, align 4
  %9 = alloca float, align 4
  %10 = alloca float, align 4
  %11 = alloca float, align 4
  %12 = alloca float, align 4
  %13 = alloca float, align 4
  %14 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 36, ptr %2) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #6
  %15 = getelementptr inbounds [3 x [3 x float]], ptr %2, i64 0, i64 0
  call void @test_rand_mat3(ptr noundef %15)
  %16 = getelementptr inbounds [3 x [3 x float]], ptr %2, i64 0, i64 0
  %17 = getelementptr inbounds [3 x float], ptr %16, i64 0, i64 0
  %18 = load float, ptr %17, align 16, !tbaa !5
  store float %18, ptr %3, align 4, !tbaa !5
  %19 = getelementptr inbounds [3 x [3 x float]], ptr %2, i64 0, i64 0
  %20 = getelementptr inbounds [3 x float], ptr %19, i64 0, i64 1
  %21 = load float, ptr %20, align 4, !tbaa !5
  store float %21, ptr %4, align 4, !tbaa !5
  %22 = getelementptr inbounds [3 x [3 x float]], ptr %2, i64 0, i64 0
  %23 = getelementptr inbounds [3 x float], ptr %22, i64 0, i64 2
  %24 = load float, ptr %23, align 8, !tbaa !5
  store float %24, ptr %5, align 4, !tbaa !5
  %25 = getelementptr inbounds [3 x [3 x float]], ptr %2, i64 0, i64 1
  %26 = getelementptr inbounds [3 x float], ptr %25, i64 0, i64 0
  %27 = load float, ptr %26, align 4, !tbaa !5
  store float %27, ptr %6, align 4, !tbaa !5
  %28 = getelementptr inbounds [3 x [3 x float]], ptr %2, i64 0, i64 1
  %29 = getelementptr inbounds [3 x float], ptr %28, i64 0, i64 1
  %30 = load float, ptr %29, align 4, !tbaa !5
  store float %30, ptr %7, align 4, !tbaa !5
  %31 = getelementptr inbounds [3 x [3 x float]], ptr %2, i64 0, i64 1
  %32 = getelementptr inbounds [3 x float], ptr %31, i64 0, i64 2
  %33 = load float, ptr %32, align 4, !tbaa !5
  store float %33, ptr %8, align 4, !tbaa !5
  %34 = getelementptr inbounds [3 x [3 x float]], ptr %2, i64 0, i64 2
  %35 = getelementptr inbounds [3 x float], ptr %34, i64 0, i64 0
  %36 = load float, ptr %35, align 8, !tbaa !5
  store float %36, ptr %9, align 4, !tbaa !5
  %37 = getelementptr inbounds [3 x [3 x float]], ptr %2, i64 0, i64 2
  %38 = getelementptr inbounds [3 x float], ptr %37, i64 0, i64 1
  %39 = load float, ptr %38, align 4, !tbaa !5
  store float %39, ptr %10, align 4, !tbaa !5
  %40 = getelementptr inbounds [3 x [3 x float]], ptr %2, i64 0, i64 2
  %41 = getelementptr inbounds [3 x float], ptr %40, i64 0, i64 2
  %42 = load float, ptr %41, align 8, !tbaa !5
  store float %42, ptr %11, align 4, !tbaa !5
  %43 = load float, ptr %3, align 4, !tbaa !5
  %44 = load float, ptr %7, align 4, !tbaa !5
  %45 = load float, ptr %11, align 4, !tbaa !5
  %46 = load float, ptr %10, align 4, !tbaa !5
  %47 = load float, ptr %8, align 4, !tbaa !5
  %48 = fmul float %46, %47
  %49 = fneg float %48
  %50 = call float @llvm.fmuladd.f32(float %44, float %45, float %49)
  %51 = load float, ptr %6, align 4, !tbaa !5
  %52 = load float, ptr %4, align 4, !tbaa !5
  %53 = load float, ptr %11, align 4, !tbaa !5
  %54 = load float, ptr %5, align 4, !tbaa !5
  %55 = load float, ptr %10, align 4, !tbaa !5
  %56 = fmul float %54, %55
  %57 = fneg float %56
  %58 = call float @llvm.fmuladd.f32(float %52, float %53, float %57)
  %59 = fmul float %51, %58
  %60 = fneg float %59
  %61 = call float @llvm.fmuladd.f32(float %43, float %50, float %60)
  %62 = load float, ptr %9, align 4, !tbaa !5
  %63 = load float, ptr %4, align 4, !tbaa !5
  %64 = load float, ptr %8, align 4, !tbaa !5
  %65 = load float, ptr %5, align 4, !tbaa !5
  %66 = load float, ptr %7, align 4, !tbaa !5
  %67 = fmul float %65, %66
  %68 = fneg float %67
  %69 = call float @llvm.fmuladd.f32(float %63, float %64, float %68)
  %70 = call float @llvm.fmuladd.f32(float %62, float %69, float %61)
  store float %70, ptr %12, align 4, !tbaa !5
  %71 = getelementptr inbounds [3 x [3 x float]], ptr %2, i64 0, i64 0
  %72 = call float @glm_mat3_det(ptr noundef %71)
  store float %72, ptr %13, align 4, !tbaa !5
  br label %73

73:                                               ; preds = %0
  %74 = load float, ptr %12, align 4, !tbaa !5
  %75 = load float, ptr %13, align 4, !tbaa !5
  %76 = call zeroext i1 @test_eq(float noundef %74, float noundef %75)
  br i1 %76, label %82, label %77

77:                                               ; preds = %73
  %78 = load ptr, ptr @stderr, align 8, !tbaa !9
  %79 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %78, ptr noundef @.str, ptr noundef @.str.671, i32 noundef 220, ptr noundef @.str.687) #6
  %80 = getelementptr inbounds %struct.test_status_t, ptr %1, i32 0, i32 0
  store ptr null, ptr %80, align 8, !tbaa !11
  %81 = getelementptr inbounds %struct.test_status_t, ptr %1, i32 0, i32 1
  store i32 0, ptr %81, align 8, !tbaa !14
  store i32 1, ptr %14, align 4
  br label %87

82:                                               ; preds = %73
  br label %83

83:                                               ; preds = %82
  br label %84

84:                                               ; preds = %83
  %85 = getelementptr inbounds %struct.test_status_t, ptr %1, i32 0, i32 0
  store ptr null, ptr %85, align 8, !tbaa !11
  %86 = getelementptr inbounds %struct.test_status_t, ptr %1, i32 0, i32 1
  store i32 1, ptr %86, align 8, !tbaa !14
  store i32 1, ptr %14, align 4
  br label %87

87:                                               ; preds = %84, %77
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #6
  call void @llvm.lifetime.end.p0(i64 36, ptr %2) #6
  %88 = load { ptr, i32 }, ptr %1, align 8
  ret { ptr, i32 } %88
}

; Function Attrs: alwaysinline nounwind uwtable
declare hidden float @glm_mat3_det(ptr noundef) #1

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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" }
attributes #2 = { nounwind "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 = { "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 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 #6 = { 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/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !10, i64 0}
!12 = !{!"test_status_t", !10, i64 0, !13, i64 8}
!13 = !{!"int", !7, i64 0}
!14 = !{!12, !13, i64 8}


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

@stderr = external local_unnamed_addr global ptr, align 8
@.str = external hidden unnamed_addr constant [94 x i8], align 1
@.str.671 = external hidden unnamed_addr constant [64 x i8], align 1
@.str.687 = external hidden unnamed_addr constant [20 x i8], align 1

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: alwaysinline nounwind uwtable
declare hidden zeroext i1 @test_eq(float noundef, float noundef) local_unnamed_addr #1

; Function Attrs: nofree nounwind
declare noundef i32 @fprintf(ptr nocapture noundef, ptr nocapture noundef readonly, ...) local_unnamed_addr #2

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

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

declare void @test_rand_mat3(ptr noundef) local_unnamed_addr #4

; Function Attrs: nounwind uwtable
define dso_local { ptr, i32 } @test_glm_mat3_det() local_unnamed_addr #5 {
  %1 = alloca [3 x [3 x float]], align 16
  call void @llvm.lifetime.start.p0(i64 36, ptr nonnull %1) #6
  call void @test_rand_mat3(ptr noundef nonnull %1) #6
  %2 = load float, ptr %1, align 16, !tbaa !5
  %3 = getelementptr inbounds i8, ptr %1, i64 4
  %4 = load float, ptr %3, align 4, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %1, i64 8
  %6 = load float, ptr %5, align 8, !tbaa !5
  %7 = getelementptr inbounds i8, ptr %1, i64 12
  %8 = load float, ptr %7, align 4, !tbaa !5
  %9 = getelementptr inbounds i8, ptr %1, i64 16
  %10 = load float, ptr %9, align 16, !tbaa !5
  %11 = getelementptr inbounds i8, ptr %1, i64 20
  %12 = load float, ptr %11, align 4, !tbaa !5
  %13 = getelementptr inbounds i8, ptr %1, i64 24
  %14 = load float, ptr %13, align 8, !tbaa !5
  %15 = getelementptr inbounds i8, ptr %1, i64 28
  %16 = load float, ptr %15, align 4, !tbaa !5
  %17 = getelementptr inbounds i8, ptr %1, i64 32
  %18 = load float, ptr %17, align 16, !tbaa !5
  %19 = fneg float %16
  %20 = fmul float %12, %19
  %21 = call float @llvm.fmuladd.f32(float %10, float %18, float %20)
  %22 = fneg float %6
  %23 = fmul float %16, %22
  %24 = call float @llvm.fmuladd.f32(float %4, float %18, float %23)
  %25 = fneg float %8
  %26 = fmul float %24, %25
  %27 = call float @llvm.fmuladd.f32(float %2, float %21, float %26)
  %28 = fmul float %10, %22
  %29 = call float @llvm.fmuladd.f32(float %4, float %12, float %28)
  %30 = call float @llvm.fmuladd.f32(float %14, float %29, float %27)
  %31 = call float @glm_mat3_det(ptr noundef nonnull %1)
  %32 = call zeroext i1 @test_eq(float noundef %30, float noundef %31)
  br i1 %32, label %36, label %33

33:                                               ; preds = %0
  %34 = load ptr, ptr @stderr, align 8, !tbaa !9
  %35 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %34, ptr noundef nonnull @.str, ptr noundef nonnull @.str.671, i32 noundef 220, ptr noundef nonnull @.str.687) #7
  br label %36

36:                                               ; preds = %0, %33
  %.sroa.3.0 = phi i32 [ 0, %33 ], [ 1, %0 ]
  call void @llvm.lifetime.end.p0(i64 36, ptr nonnull %1) #6
  %.fca.1.insert = insertvalue { ptr, i32 } { ptr null, i32 poison }, i32 %.sroa.3.0, 1
  ret { ptr, i32 } %.fca.1.insert
}

; Function Attrs: alwaysinline nounwind uwtable
declare hidden float @glm_mat3_det(ptr noundef) local_unnamed_addr #1

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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" }
attributes #2 = { nofree nounwind "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 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { "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 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 #6 = { nounwind }
attributes #7 = { cold 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/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,ReassociatePass,SROAPass,SimplifyCFGPass