; 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
@.str.22 = external hidden unnamed_addr constant [45 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [45 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [45 x i8], align 1
@.str.25 = external hidden unnamed_addr constant [45 x i8], align 1

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

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

; Function Attrs: nounwind uwtable
define dso_local { ptr, i32 } @test_assert_quat_eq_abs(ptr noundef %0, ptr noundef %1) #2 {
  %3 = alloca %struct.test_status_t, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  br label %6

6:                                                ; preds = %2
  %7 = load ptr, ptr %4, align 8, !tbaa !5
  %8 = getelementptr inbounds float, ptr %7, i64 0
  %9 = load float, ptr %8, align 4, !tbaa !9
  %10 = call float @llvm.fabs.f32(float %9)
  %11 = load ptr, ptr %5, align 8, !tbaa !5
  %12 = getelementptr inbounds float, ptr %11, i64 0
  %13 = load float, ptr %12, align 4, !tbaa !9
  %14 = call float @llvm.fabs.f32(float %13)
  %15 = fsub float %10, %14
  %16 = call float @llvm.fabs.f32(float %15)
  %17 = fpext float %16 to double
  %18 = fcmp ole double %17, 9.000000e-04
  br i1 %18, label %24, label %19

19:                                               ; preds = %6
  %20 = load ptr, ptr @stderr, align 8, !tbaa !5
  %21 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %20, ptr noundef @.str, ptr noundef @.str.1, i32 noundef 560, ptr noundef @.str.22) #3
  %22 = getelementptr inbounds %struct.test_status_t, ptr %3, i32 0, i32 0
  store ptr null, ptr %22, align 8, !tbaa !11
  %23 = getelementptr inbounds %struct.test_status_t, ptr %3, i32 0, i32 1
  store i32 0, ptr %23, align 8, !tbaa !14
  br label %88

24:                                               ; preds = %6
  br label %25

25:                                               ; preds = %24
  br label %26

26:                                               ; preds = %25
  %27 = load ptr, ptr %4, align 8, !tbaa !5
  %28 = getelementptr inbounds float, ptr %27, i64 1
  %29 = load float, ptr %28, align 4, !tbaa !9
  %30 = call float @llvm.fabs.f32(float %29)
  %31 = load ptr, ptr %5, align 8, !tbaa !5
  %32 = getelementptr inbounds float, ptr %31, i64 1
  %33 = load float, ptr %32, align 4, !tbaa !9
  %34 = call float @llvm.fabs.f32(float %33)
  %35 = fsub float %30, %34
  %36 = call float @llvm.fabs.f32(float %35)
  %37 = fpext float %36 to double
  %38 = fcmp ole double %37, 9.000000e-04
  br i1 %38, label %44, label %39

39:                                               ; preds = %26
  %40 = load ptr, ptr @stderr, align 8, !tbaa !5
  %41 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %40, ptr noundef @.str, ptr noundef @.str.1, i32 noundef 561, ptr noundef @.str.23) #3
  %42 = getelementptr inbounds %struct.test_status_t, ptr %3, i32 0, i32 0
  store ptr null, ptr %42, align 8, !tbaa !11
  %43 = getelementptr inbounds %struct.test_status_t, ptr %3, i32 0, i32 1
  store i32 0, ptr %43, align 8, !tbaa !14
  br label %88

44:                                               ; preds = %26
  br label %45

45:                                               ; preds = %44
  br label %46

46:                                               ; preds = %45
  %47 = load ptr, ptr %4, align 8, !tbaa !5
  %48 = getelementptr inbounds float, ptr %47, i64 2
  %49 = load float, ptr %48, align 4, !tbaa !9
  %50 = call float @llvm.fabs.f32(float %49)
  %51 = load ptr, ptr %5, align 8, !tbaa !5
  %52 = getelementptr inbounds float, ptr %51, i64 2
  %53 = load float, ptr %52, align 4, !tbaa !9
  %54 = call float @llvm.fabs.f32(float %53)
  %55 = fsub float %50, %54
  %56 = call float @llvm.fabs.f32(float %55)
  %57 = fpext float %56 to double
  %58 = fcmp ole double %57, 9.000000e-04
  br i1 %58, label %64, label %59

59:                                               ; preds = %46
  %60 = load ptr, ptr @stderr, align 8, !tbaa !5
  %61 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %60, ptr noundef @.str, ptr noundef @.str.1, i32 noundef 562, ptr noundef @.str.24) #3
  %62 = getelementptr inbounds %struct.test_status_t, ptr %3, i32 0, i32 0
  store ptr null, ptr %62, align 8, !tbaa !11
  %63 = getelementptr inbounds %struct.test_status_t, ptr %3, i32 0, i32 1
  store i32 0, ptr %63, align 8, !tbaa !14
  br label %88

64:                                               ; preds = %46
  br label %65

65:                                               ; preds = %64
  br label %66

66:                                               ; preds = %65
  %67 = load ptr, ptr %4, align 8, !tbaa !5
  %68 = getelementptr inbounds float, ptr %67, i64 3
  %69 = load float, ptr %68, align 4, !tbaa !9
  %70 = call float @llvm.fabs.f32(float %69)
  %71 = load ptr, ptr %5, align 8, !tbaa !5
  %72 = getelementptr inbounds float, ptr %71, i64 3
  %73 = load float, ptr %72, align 4, !tbaa !9
  %74 = call float @llvm.fabs.f32(float %73)
  %75 = fsub float %70, %74
  %76 = call float @llvm.fabs.f32(float %75)
  %77 = fpext float %76 to double
  %78 = fcmp ole double %77, 9.000000e-04
  br i1 %78, label %84, label %79

79:                                               ; preds = %66
  %80 = load ptr, ptr @stderr, align 8, !tbaa !5
  %81 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %80, ptr noundef @.str, ptr noundef @.str.1, i32 noundef 563, ptr noundef @.str.25) #3
  %82 = getelementptr inbounds %struct.test_status_t, ptr %3, i32 0, i32 0
  store ptr null, ptr %82, align 8, !tbaa !11
  %83 = getelementptr inbounds %struct.test_status_t, ptr %3, i32 0, i32 1
  store i32 0, ptr %83, align 8, !tbaa !14
  br label %88

84:                                               ; preds = %66
  br label %85

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

88:                                               ; preds = %85, %79, %59, %39, %19
  %89 = load { ptr, i32 }, ptr %3, align 8
  ret { ptr, i32 } %89
}

attributes #0 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #1 = { 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 = { 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 = { 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
@.str.22 = external hidden unnamed_addr constant [45 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [45 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [45 x i8], align 1
@.str.25 = external hidden unnamed_addr constant [45 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_abs(ptr nocapture noundef readonly %0, ptr nocapture noundef readonly %1) local_unnamed_addr #2 {
  %3 = load float, ptr %0, align 4, !tbaa !5
  %4 = tail call float @llvm.fabs.f32(float %3)
  %5 = load float, ptr %1, align 4, !tbaa !5
  %6 = tail call float @llvm.fabs.f32(float %5)
  %7 = fsub float %4, %6
  %8 = tail call float @llvm.fabs.f32(float %7)
  %9 = fpext float %8 to double
  %10 = fcmp ugt double %9, 9.000000e-04
  br i1 %10, label %11, label %14

11:                                               ; preds = %2
  %12 = load ptr, ptr @stderr, align 8, !tbaa !9
  %13 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %12, ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 560, ptr noundef nonnull @.str.22) #3
  br label %56

14:                                               ; preds = %2
  %15 = getelementptr inbounds i8, ptr %0, i64 4
  %16 = load float, ptr %15, align 4, !tbaa !5
  %17 = tail call float @llvm.fabs.f32(float %16)
  %18 = getelementptr inbounds i8, ptr %1, i64 4
  %19 = load float, ptr %18, align 4, !tbaa !5
  %20 = tail call float @llvm.fabs.f32(float %19)
  %21 = fsub float %17, %20
  %22 = tail call float @llvm.fabs.f32(float %21)
  %23 = fpext float %22 to double
  %24 = fcmp ugt double %23, 9.000000e-04
  br i1 %24, label %25, label %28

25:                                               ; preds = %14
  %26 = load ptr, ptr @stderr, align 8, !tbaa !9
  %27 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %26, ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 561, ptr noundef nonnull @.str.23) #3
  br label %56

28:                                               ; preds = %14
  %29 = getelementptr inbounds i8, ptr %0, i64 8
  %30 = load float, ptr %29, align 4, !tbaa !5
  %31 = tail call float @llvm.fabs.f32(float %30)
  %32 = getelementptr inbounds i8, ptr %1, i64 8
  %33 = load float, ptr %32, align 4, !tbaa !5
  %34 = tail call float @llvm.fabs.f32(float %33)
  %35 = fsub float %31, %34
  %36 = tail call float @llvm.fabs.f32(float %35)
  %37 = fpext float %36 to double
  %38 = fcmp ugt double %37, 9.000000e-04
  br i1 %38, label %39, label %42

39:                                               ; preds = %28
  %40 = load ptr, ptr @stderr, align 8, !tbaa !9
  %41 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %40, ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 562, ptr noundef nonnull @.str.24) #3
  br label %56

42:                                               ; preds = %28
  %43 = getelementptr inbounds i8, ptr %0, i64 12
  %44 = load float, ptr %43, align 4, !tbaa !5
  %45 = tail call float @llvm.fabs.f32(float %44)
  %46 = getelementptr inbounds i8, ptr %1, i64 12
  %47 = load float, ptr %46, align 4, !tbaa !5
  %48 = tail call float @llvm.fabs.f32(float %47)
  %49 = fsub float %45, %48
  %50 = tail call float @llvm.fabs.f32(float %49)
  %51 = fpext float %50 to double
  %52 = fcmp ugt double %51, 9.000000e-04
  br i1 %52, label %53, label %56

53:                                               ; preds = %42
  %54 = load ptr, ptr @stderr, align 8, !tbaa !9
  %55 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %54, ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 563, ptr noundef nonnull @.str.25) #3
  br label %56

56:                                               ; preds = %42, %53, %39, %25, %11
  %.sroa.6.0 = phi i32 [ 0, %53 ], [ 0, %39 ], [ 0, %25 ], [ 0, %11 ], [ 1, %42 ]
  %.fca.1.insert = insertvalue { ptr, i32 } { ptr null, i32 poison }, i32 %.sroa.6.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