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

%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.1 = external hidden unnamed_addr constant [66 x i8], align 1
@__const.test_assert_quat_eq_identity.p = external hidden unnamed_addr constant [4 x float], align 16
@.str.26 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.27 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.28 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.29 = external hidden unnamed_addr constant [31 x i8], align 1

; 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) #0

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

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

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

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

; Function Attrs: nounwind uwtable
define dso_local { ptr, i32 } @test_assert_quat_eq_identity(ptr noundef %0) #4 {
  %2 = alloca %struct.test_status_t, align 8
  %3 = alloca ptr, align 8
  %4 = alloca [4 x float], align 16
  %5 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr %4) #5
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %4, ptr align 16 @__const.test_assert_quat_eq_identity.p, i64 16, i1 false)
  br label %6

6:                                                ; preds = %1
  %7 = load ptr, ptr %3, align 8, !tbaa !5
  %8 = getelementptr inbounds float, ptr %7, i64 0
  %9 = load float, ptr %8, align 4, !tbaa !9
  %10 = getelementptr inbounds [4 x float], ptr %4, i64 0, i64 0
  %11 = load float, ptr %10, align 16, !tbaa !9
  %12 = fsub float %9, %11
  %13 = call float @llvm.fabs.f32(float %12)
  %14 = fpext float %13 to double
  %15 = fcmp ole double %14, 9.000000e-06
  br i1 %15, label %21, label %16

16:                                               ; preds = %6
  %17 = load ptr, ptr @stderr, align 8, !tbaa !5
  %18 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %17, ptr noundef @.str, ptr noundef @.str.1, i32 noundef 582, ptr noundef @.str.26) #5
  %19 = getelementptr inbounds %struct.test_status_t, ptr %2, i32 0, i32 0
  store ptr null, ptr %19, align 8, !tbaa !11
  %20 = getelementptr inbounds %struct.test_status_t, ptr %2, i32 0, i32 1
  store i32 0, ptr %20, align 8, !tbaa !14
  store i32 1, ptr %5, align 4
  br label %80

21:                                               ; preds = %6
  br label %22

22:                                               ; preds = %21
  br label %23

23:                                               ; preds = %22
  br label %24

24:                                               ; preds = %23
  %25 = load ptr, ptr %3, align 8, !tbaa !5
  %26 = getelementptr inbounds float, ptr %25, i64 1
  %27 = load float, ptr %26, align 4, !tbaa !9
  %28 = getelementptr inbounds [4 x float], ptr %4, i64 0, i64 1
  %29 = load float, ptr %28, align 4, !tbaa !9
  %30 = fsub float %27, %29
  %31 = call float @llvm.fabs.f32(float %30)
  %32 = fpext float %31 to double
  %33 = fcmp ole double %32, 9.000000e-06
  br i1 %33, label %39, label %34

34:                                               ; preds = %24
  %35 = load ptr, ptr @stderr, align 8, !tbaa !5
  %36 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %35, ptr noundef @.str, ptr noundef @.str.1, i32 noundef 583, ptr noundef @.str.27) #5
  %37 = getelementptr inbounds %struct.test_status_t, ptr %2, i32 0, i32 0
  store ptr null, ptr %37, align 8, !tbaa !11
  %38 = getelementptr inbounds %struct.test_status_t, ptr %2, i32 0, i32 1
  store i32 0, ptr %38, align 8, !tbaa !14
  store i32 1, ptr %5, align 4
  br label %80

39:                                               ; preds = %24
  br label %40

40:                                               ; preds = %39
  br label %41

41:                                               ; preds = %40
  br label %42

42:                                               ; preds = %41
  %43 = load ptr, ptr %3, align 8, !tbaa !5
  %44 = getelementptr inbounds float, ptr %43, i64 2
  %45 = load float, ptr %44, align 4, !tbaa !9
  %46 = getelementptr inbounds [4 x float], ptr %4, i64 0, i64 2
  %47 = load float, ptr %46, align 8, !tbaa !9
  %48 = fsub float %45, %47
  %49 = call float @llvm.fabs.f32(float %48)
  %50 = fpext float %49 to double
  %51 = fcmp ole double %50, 9.000000e-06
  br i1 %51, label %57, label %52

52:                                               ; preds = %42
  %53 = load ptr, ptr @stderr, align 8, !tbaa !5
  %54 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %53, ptr noundef @.str, ptr noundef @.str.1, i32 noundef 584, ptr noundef @.str.28) #5
  %55 = getelementptr inbounds %struct.test_status_t, ptr %2, i32 0, i32 0
  store ptr null, ptr %55, align 8, !tbaa !11
  %56 = getelementptr inbounds %struct.test_status_t, ptr %2, i32 0, i32 1
  store i32 0, ptr %56, align 8, !tbaa !14
  store i32 1, ptr %5, align 4
  br label %80

57:                                               ; preds = %42
  br label %58

58:                                               ; preds = %57
  br label %59

59:                                               ; preds = %58
  br label %60

60:                                               ; preds = %59
  %61 = load ptr, ptr %3, align 8, !tbaa !5
  %62 = getelementptr inbounds float, ptr %61, i64 3
  %63 = load float, ptr %62, align 4, !tbaa !9
  %64 = getelementptr inbounds [4 x float], ptr %4, i64 0, i64 3
  %65 = load float, ptr %64, align 4, !tbaa !9
  %66 = fsub float %63, %65
  %67 = call float @llvm.fabs.f32(float %66)
  %68 = fpext float %67 to double
  %69 = fcmp ole double %68, 9.000000e-06
  br i1 %69, label %75, label %70

70:                                               ; preds = %60
  %71 = load ptr, ptr @stderr, align 8, !tbaa !5
  %72 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %71, ptr noundef @.str, ptr noundef @.str.1, i32 noundef 585, ptr noundef @.str.29) #5
  %73 = getelementptr inbounds %struct.test_status_t, ptr %2, i32 0, i32 0
  store ptr null, ptr %73, align 8, !tbaa !11
  %74 = getelementptr inbounds %struct.test_status_t, ptr %2, i32 0, i32 1
  store i32 0, ptr %74, align 8, !tbaa !14
  store i32 1, ptr %5, align 4
  br label %80

75:                                               ; preds = %60
  br label %76

76:                                               ; preds = %75
  br label %77

77:                                               ; preds = %76
  %78 = getelementptr inbounds %struct.test_status_t, ptr %2, i32 0, i32 0
  store ptr null, ptr %78, align 8, !tbaa !11
  %79 = getelementptr inbounds %struct.test_status_t, ptr %2, i32 0, i32 1
  store i32 1, ptr %79, align 8, !tbaa !14
  store i32 1, ptr %5, align 4
  br label %80

80:                                               ; preds = %77, %70, %52, %34, %16
  call void @llvm.lifetime.end.p0(i64 16, ptr %4) #5
  %81 = load { ptr, i32 }, ptr %2, align 8
  ret { ptr, i32 } %81
}

attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #3 = { 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 #4 = { 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 = { 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"}
!9 = !{!10, !10, i64 0}
!10 = !{!"float", !7, i64 0}
!11 = !{!12, !6, i64 0}
!12 = !{!"test_status_t", !6, 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.1 = external hidden unnamed_addr constant [66 x i8], align 1
@__const.test_assert_quat_eq_identity.p = external hidden unnamed_addr constant [4 x float], align 16
@.str.26 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.27 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.28 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.29 = external hidden unnamed_addr constant [31 x i8], align 1

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

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

; Function Attrs: nofree nounwind uwtable
define dso_local { ptr, i32 } @test_assert_quat_eq_identity(ptr nocapture noundef readonly %0) local_unnamed_addr #2 {
  %.sroa.0.0.copyload = load float, ptr @__const.test_assert_quat_eq_identity.p, align 16
  %.sroa.5.0.copyload = load float, ptr getelementptr inbounds (i8, ptr @__const.test_assert_quat_eq_identity.p, i64 8), align 8
  %.sroa.6.0.copyload = load float, ptr getelementptr inbounds (i8, ptr @__const.test_assert_quat_eq_identity.p, i64 12), align 4
  %2 = load float, ptr %0, align 4, !tbaa !5
  %3 = fsub float %2, %.sroa.0.0.copyload
  %4 = tail call float @llvm.fabs.f32(float %3)
  %5 = fpext float %4 to double
  %6 = fcmp ugt double %5, 9.000000e-06
  br i1 %6, label %7, label %10

7:                                                ; preds = %1
  %8 = load ptr, ptr @stderr, align 8, !tbaa !9
  %9 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %8, ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 582, ptr noundef nonnull @.str.26) #3
  br label %40

10:                                               ; preds = %1
  %.sroa.4.0.copyload = load float, ptr getelementptr inbounds (i8, ptr @__const.test_assert_quat_eq_identity.p, i64 4), align 4
  %11 = getelementptr inbounds i8, ptr %0, i64 4
  %12 = load float, ptr %11, align 4, !tbaa !5
  %13 = fsub float %12, %.sroa.4.0.copyload
  %14 = tail call float @llvm.fabs.f32(float %13)
  %15 = fpext float %14 to double
  %16 = fcmp ugt double %15, 9.000000e-06
  br i1 %16, label %17, label %20

17:                                               ; preds = %10
  %18 = load ptr, ptr @stderr, align 8, !tbaa !9
  %19 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %18, ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 583, ptr noundef nonnull @.str.27) #3
  br label %40

20:                                               ; preds = %10
  %21 = getelementptr inbounds i8, ptr %0, i64 8
  %22 = load float, ptr %21, align 4, !tbaa !5
  %23 = fsub float %22, %.sroa.5.0.copyload
  %24 = tail call float @llvm.fabs.f32(float %23)
  %25 = fpext float %24 to double
  %26 = fcmp ugt double %25, 9.000000e-06
  br i1 %26, label %27, label %30

27:                                               ; preds = %20
  %28 = load ptr, ptr @stderr, align 8, !tbaa !9
  %29 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %28, ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 584, ptr noundef nonnull @.str.28) #3
  br label %40

30:                                               ; preds = %20
  %31 = getelementptr inbounds i8, ptr %0, i64 12
  %32 = load float, ptr %31, align 4, !tbaa !5
  %33 = fsub float %32, %.sroa.6.0.copyload
  %34 = tail call float @llvm.fabs.f32(float %33)
  %35 = fpext float %34 to double
  %36 = fcmp ugt double %35, 9.000000e-06
  br i1 %36, label %37, label %40

37:                                               ; preds = %30
  %38 = load ptr, ptr @stderr, align 8, !tbaa !9
  %39 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %38, ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 585, ptr noundef nonnull @.str.29) #3
  br label %40

40:                                               ; preds = %30, %37, %27, %17, %7
  %.sroa.65.0 = phi i32 [ 0, %37 ], [ 0, %27 ], [ 0, %17 ], [ 0, %7 ], [ 1, %30 ]
  %.fca.1.insert = insertvalue { ptr, i32 } { ptr null, i32 poison }, i32 %.sroa.65.0, 1
  ret { ptr, i32 } %.fca.1.insert
}

attributes #0 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #1 = { 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 #2 = { nofree 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 #3 = { 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,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass