; 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.13 = external hidden unnamed_addr constant [97 x i8], align 1
@.str.610 = external hidden unnamed_addr constant [64 x i8], align 1
@__const.test_glm_mat2_identity.m1 = external hidden unnamed_addr constant [2 x [2 x float]], align 16
@__const.test_glm_mat2_identity.m2 = external hidden unnamed_addr constant [2 x [2 x float]], align 16
@.str.625 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.626 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.627 = external hidden unnamed_addr constant [33 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: 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) #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: nounwind uwtable
define dso_local { ptr, i32 } @test_glm_mat2_identity() #3 {
  %1 = alloca %struct.test_status_t, align 8
  %2 = alloca [2 x [2 x float]], align 16
  %3 = alloca [2 x [2 x float]], align 16
  %4 = alloca [2 x [2 x float]], align 16
  %5 = alloca %struct.test_status_t, align 8
  %6 = alloca %struct.test_status_t, align 8
  %7 = alloca i32, align 4
  %8 = alloca %struct.test_status_t, align 8
  %9 = alloca %struct.test_status_t, align 8
  %10 = alloca %struct.test_status_t, align 8
  %11 = alloca %struct.test_status_t, align 8
  call void @llvm.lifetime.start.p0(i64 16, ptr %2) #6
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %2, ptr align 16 @__const.test_glm_mat2_identity.m1, i64 16, i1 false)
  call void @llvm.lifetime.start.p0(i64 16, ptr %3) #6
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %3, ptr align 16 @__const.test_glm_mat2_identity.m2, i64 16, i1 false)
  call void @llvm.lifetime.start.p0(i64 16, ptr %4) #6
  %12 = getelementptr inbounds [2 x [2 x float]], ptr %4, i64 0, i64 0
  call void @glm_mat2_identity(ptr noundef %12)
  br label %13

13:                                               ; preds = %0
  call void @llvm.lifetime.start.p0(i64 16, ptr %5) #6
  call void @llvm.lifetime.start.p0(i64 16, ptr %6) #6
  %14 = getelementptr inbounds [2 x [2 x float]], ptr %2, i64 0, i64 0
  %15 = call { ptr, i32 } @test_assert_mat2_eq_identity(ptr noundef %14)
  %16 = getelementptr inbounds { ptr, i32 }, ptr %6, i32 0, i32 0
  %17 = extractvalue { ptr, i32 } %15, 0
  store ptr %17, ptr %16, align 8
  %18 = getelementptr inbounds { ptr, i32 }, ptr %6, i32 0, i32 1
  %19 = extractvalue { ptr, i32 } %15, 1
  store i32 %19, ptr %18, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %5, ptr align 8 %6, i64 16, i1 false), !tbaa.struct !5
  call void @llvm.lifetime.end.p0(i64 16, ptr %6) #6
  %20 = getelementptr inbounds %struct.test_status_t, ptr %5, i32 0, i32 1
  %21 = load i32, ptr %20, align 8, !tbaa !12
  %22 = icmp ne i32 %21, 1
  br i1 %22, label %23, label %30

23:                                               ; preds = %13
  %24 = load ptr, ptr @stderr, align 8, !tbaa !6
  %25 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %24, ptr noundef @.str.13, ptr noundef @.str.610, i32 noundef 76, ptr noundef @.str.625) #6
  %26 = getelementptr inbounds %struct.test_status_t, ptr %1, i32 0, i32 0
  %27 = getelementptr inbounds %struct.test_status_t, ptr %5, i32 0, i32 0
  %28 = load ptr, ptr %27, align 8, !tbaa !14
  store ptr %28, ptr %26, align 8, !tbaa !14
  %29 = getelementptr inbounds %struct.test_status_t, ptr %1, i32 0, i32 1
  store i32 0, ptr %29, align 8, !tbaa !12
  store i32 1, ptr %7, align 4
  br label %31

30:                                               ; preds = %13
  store i32 0, ptr %7, align 4
  br label %31

31:                                               ; preds = %30, %23
  call void @llvm.lifetime.end.p0(i64 16, ptr %5) #6
  %32 = load i32, ptr %7, align 4
  switch i32 %32, label %84 [
    i32 0, label %33
  ]

33:                                               ; preds = %31
  br label %34

34:                                               ; preds = %33
  br label %35

35:                                               ; preds = %34
  br label %36

36:                                               ; preds = %35
  call void @llvm.lifetime.start.p0(i64 16, ptr %8) #6
  call void @llvm.lifetime.start.p0(i64 16, ptr %9) #6
  %37 = getelementptr inbounds [2 x [2 x float]], ptr %3, i64 0, i64 0
  %38 = call { ptr, i32 } @test_assert_mat2_eq_identity(ptr noundef %37)
  %39 = getelementptr inbounds { ptr, i32 }, ptr %9, i32 0, i32 0
  %40 = extractvalue { ptr, i32 } %38, 0
  store ptr %40, ptr %39, align 8
  %41 = getelementptr inbounds { ptr, i32 }, ptr %9, i32 0, i32 1
  %42 = extractvalue { ptr, i32 } %38, 1
  store i32 %42, ptr %41, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %8, ptr align 8 %9, i64 16, i1 false), !tbaa.struct !5
  call void @llvm.lifetime.end.p0(i64 16, ptr %9) #6
  %43 = getelementptr inbounds %struct.test_status_t, ptr %8, i32 0, i32 1
  %44 = load i32, ptr %43, align 8, !tbaa !12
  %45 = icmp ne i32 %44, 1
  br i1 %45, label %46, label %53

46:                                               ; preds = %36
  %47 = load ptr, ptr @stderr, align 8, !tbaa !6
  %48 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %47, ptr noundef @.str.13, ptr noundef @.str.610, i32 noundef 77, ptr noundef @.str.626) #6
  %49 = getelementptr inbounds %struct.test_status_t, ptr %1, i32 0, i32 0
  %50 = getelementptr inbounds %struct.test_status_t, ptr %8, i32 0, i32 0
  %51 = load ptr, ptr %50, align 8, !tbaa !14
  store ptr %51, ptr %49, align 8, !tbaa !14
  %52 = getelementptr inbounds %struct.test_status_t, ptr %1, i32 0, i32 1
  store i32 0, ptr %52, align 8, !tbaa !12
  store i32 1, ptr %7, align 4
  br label %54

53:                                               ; preds = %36
  store i32 0, ptr %7, align 4
  br label %54

54:                                               ; preds = %53, %46
  call void @llvm.lifetime.end.p0(i64 16, ptr %8) #6
  %55 = load i32, ptr %7, align 4
  switch i32 %55, label %84 [
    i32 0, label %56
  ]

56:                                               ; preds = %54
  br label %57

57:                                               ; preds = %56
  br label %58

58:                                               ; preds = %57
  br label %59

59:                                               ; preds = %58
  call void @llvm.lifetime.start.p0(i64 16, ptr %10) #6
  call void @llvm.lifetime.start.p0(i64 16, ptr %11) #6
  %60 = getelementptr inbounds [2 x [2 x float]], ptr %4, i64 0, i64 0
  %61 = call { ptr, i32 } @test_assert_mat2_eq_identity(ptr noundef %60)
  %62 = getelementptr inbounds { ptr, i32 }, ptr %11, i32 0, i32 0
  %63 = extractvalue { ptr, i32 } %61, 0
  store ptr %63, ptr %62, align 8
  %64 = getelementptr inbounds { ptr, i32 }, ptr %11, i32 0, i32 1
  %65 = extractvalue { ptr, i32 } %61, 1
  store i32 %65, ptr %64, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %10, ptr align 8 %11, i64 16, i1 false), !tbaa.struct !5
  call void @llvm.lifetime.end.p0(i64 16, ptr %11) #6
  %66 = getelementptr inbounds %struct.test_status_t, ptr %10, i32 0, i32 1
  %67 = load i32, ptr %66, align 8, !tbaa !12
  %68 = icmp ne i32 %67, 1
  br i1 %68, label %69, label %76

69:                                               ; preds = %59
  %70 = load ptr, ptr @stderr, align 8, !tbaa !6
  %71 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %70, ptr noundef @.str.13, ptr noundef @.str.610, i32 noundef 78, ptr noundef @.str.627) #6
  %72 = getelementptr inbounds %struct.test_status_t, ptr %1, i32 0, i32 0
  %73 = getelementptr inbounds %struct.test_status_t, ptr %10, i32 0, i32 0
  %74 = load ptr, ptr %73, align 8, !tbaa !14
  store ptr %74, ptr %72, align 8, !tbaa !14
  %75 = getelementptr inbounds %struct.test_status_t, ptr %1, i32 0, i32 1
  store i32 0, ptr %75, align 8, !tbaa !12
  store i32 1, ptr %7, align 4
  br label %77

76:                                               ; preds = %59
  store i32 0, ptr %7, align 4
  br label %77

77:                                               ; preds = %76, %69
  call void @llvm.lifetime.end.p0(i64 16, ptr %10) #6
  %78 = load i32, ptr %7, align 4
  switch i32 %78, label %84 [
    i32 0, label %79
  ]

79:                                               ; preds = %77
  br label %80

80:                                               ; preds = %79
  br label %81

81:                                               ; preds = %80
  %82 = getelementptr inbounds %struct.test_status_t, ptr %1, i32 0, i32 0
  store ptr null, ptr %82, align 8, !tbaa !14
  %83 = getelementptr inbounds %struct.test_status_t, ptr %1, i32 0, i32 1
  store i32 1, ptr %83, align 8, !tbaa !12
  store i32 1, ptr %7, align 4
  br label %84

84:                                               ; preds = %81, %77, %54, %31
  call void @llvm.lifetime.end.p0(i64 16, ptr %4) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %3) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %2) #6
  %85 = load { ptr, i32 }, ptr %1, align 8
  ret { ptr, i32 } %85
}

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

declare { ptr, i32 } @test_assert_mat2_eq_identity(ptr noundef) #5

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

@stderr = external local_unnamed_addr global ptr, align 8
@.str.13 = external hidden unnamed_addr constant [97 x i8], align 1
@.str.610 = external hidden unnamed_addr constant [64 x i8], align 1
@__const.test_glm_mat2_identity.m1 = external hidden unnamed_addr constant [2 x [2 x float]], align 16
@__const.test_glm_mat2_identity.m2 = external hidden unnamed_addr constant [2 x [2 x float]], align 16
@.str.625 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.626 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.627 = external hidden unnamed_addr constant [33 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: 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) #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: nounwind uwtable
define dso_local { ptr, i32 } @test_glm_mat2_identity() local_unnamed_addr #3 {
  %1 = alloca [2 x [2 x float]], align 16
  %2 = alloca [2 x [2 x float]], align 16
  %3 = alloca [2 x [2 x float]], align 16
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %1) #6
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(16) %1, ptr noundef nonnull align 16 dereferenceable(16) @__const.test_glm_mat2_identity.m1, i64 16, i1 false)
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %2) #6
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(16) %2, ptr noundef nonnull align 16 dereferenceable(16) @__const.test_glm_mat2_identity.m2, i64 16, i1 false)
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %3) #6
  call void @glm_mat2_identity(ptr noundef nonnull %3)
  %4 = call { ptr, i32 } @test_assert_mat2_eq_identity(ptr noundef nonnull %1) #6
  %5 = extractvalue { ptr, i32 } %4, 1
  %.not = icmp eq i32 %5, 1
  br i1 %.not, label %.critedge, label %6

6:                                                ; preds = %0
  %7 = extractvalue { ptr, i32 } %4, 0
  %8 = load ptr, ptr @stderr, align 8, !tbaa !5
  %9 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %8, ptr noundef nonnull @.str.13, ptr noundef nonnull @.str.610, i32 noundef 76, ptr noundef nonnull @.str.625) #7
  br label %24

.critedge:                                        ; preds = %0
  %10 = call { ptr, i32 } @test_assert_mat2_eq_identity(ptr noundef nonnull %2) #6
  %11 = extractvalue { ptr, i32 } %10, 1
  %.not21 = icmp eq i32 %11, 1
  br i1 %.not21, label %16, label %12

12:                                               ; preds = %.critedge
  %13 = extractvalue { ptr, i32 } %10, 0
  %14 = load ptr, ptr @stderr, align 8, !tbaa !5
  %15 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %14, ptr noundef nonnull @.str.13, ptr noundef nonnull @.str.610, i32 noundef 77, ptr noundef nonnull @.str.626) #7
  br label %24

16:                                               ; preds = %.critedge
  %17 = call { ptr, i32 } @test_assert_mat2_eq_identity(ptr noundef nonnull %3) #6
  %18 = extractvalue { ptr, i32 } %17, 1
  %.not22 = icmp eq i32 %18, 1
  br i1 %.not22, label %23, label %19

19:                                               ; preds = %16
  %20 = extractvalue { ptr, i32 } %17, 0
  %21 = load ptr, ptr @stderr, align 8, !tbaa !5
  %22 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %21, ptr noundef nonnull @.str.13, ptr noundef nonnull @.str.610, i32 noundef 78, ptr noundef nonnull @.str.627) #7
  br label %23

23:                                               ; preds = %16, %19
  %spec.select = phi ptr [ %20, %19 ], [ null, %16 ]
  %spec.select23 = zext i1 %.not22 to i32
  br label %24

24:                                               ; preds = %12, %23, %6
  %.sroa.019.3 = phi ptr [ %13, %12 ], [ %7, %6 ], [ %spec.select, %23 ]
  %.sroa.520.3 = phi i32 [ 0, %12 ], [ 0, %6 ], [ %spec.select23, %23 ]
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %3) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %2) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %1) #6
  %.fca.0.insert = insertvalue { ptr, i32 } poison, ptr %.sroa.019.3, 0
  %.fca.1.insert = insertvalue { ptr, i32 } %.fca.0.insert, i32 %.sroa.520.3, 1
  ret { ptr, i32 } %.fca.1.insert
}

; Function Attrs: alwaysinline nounwind uwtable
declare hidden void @glm_mat2_identity(ptr noundef) local_unnamed_addr #4

declare { ptr, i32 } @test_assert_mat2_eq_identity(ptr noundef) local_unnamed_addr #5

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #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" }
attributes #5 = { "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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}


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