; 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.5 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [24 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 nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

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

; Function Attrs: nounwind uwtable
define dso_local { ptr, i32 } @test_assert_mat2_eq_identity(ptr noundef %0) #2 {
  %2 = alloca %struct.test_status_t, align 8
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  store i32 0, ptr %4, align 4, !tbaa !9
  br label %7

7:                                                ; preds = %61, %1
  %8 = load i32, ptr %4, align 4, !tbaa !9
  %9 = icmp slt i32 %8, 2
  br i1 %9, label %10, label %64

10:                                               ; preds = %7
  store i32 0, ptr %5, align 4, !tbaa !9
  br label %11

11:                                               ; preds = %57, %10
  %12 = load i32, ptr %5, align 4, !tbaa !9
  %13 = icmp slt i32 %12, 2
  br i1 %13, label %14, label %60

14:                                               ; preds = %11
  %15 = load i32, ptr %4, align 4, !tbaa !9
  %16 = load i32, ptr %5, align 4, !tbaa !9
  %17 = icmp eq i32 %15, %16
  br i1 %17, label %18, label %37

18:                                               ; preds = %14
  br label %19

19:                                               ; preds = %18
  %20 = load ptr, ptr %3, align 8, !tbaa !5
  %21 = load i32, ptr %4, align 4, !tbaa !9
  %22 = sext i32 %21 to i64
  %23 = getelementptr inbounds [2 x float], ptr %20, i64 %22
  %24 = load i32, ptr %5, align 4, !tbaa !9
  %25 = sext i32 %24 to i64
  %26 = getelementptr inbounds [2 x float], ptr %23, i64 0, i64 %25
  %27 = load float, ptr %26, align 4, !tbaa !11
  %28 = call zeroext i1 @test_eq(float noundef %27, float noundef 1.000000e+00)
  br i1 %28, label %34, label %29

29:                                               ; preds = %19
  %30 = load ptr, ptr @stderr, align 8, !tbaa !5
  %31 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %30, ptr noundef @.str, ptr noundef @.str.1, i32 noundef 245, ptr noundef @.str.5) #4
  %32 = getelementptr inbounds %struct.test_status_t, ptr %2, i32 0, i32 0
  store ptr null, ptr %32, align 8, !tbaa !13
  %33 = getelementptr inbounds %struct.test_status_t, ptr %2, i32 0, i32 1
  store i32 0, ptr %33, align 8, !tbaa !15
  store i32 1, ptr %6, align 4
  br label %67

34:                                               ; preds = %19
  br label %35

35:                                               ; preds = %34
  br label %36

36:                                               ; preds = %35
  br label %56

37:                                               ; preds = %14
  br label %38

38:                                               ; preds = %37
  %39 = load ptr, ptr %3, align 8, !tbaa !5
  %40 = load i32, ptr %4, align 4, !tbaa !9
  %41 = sext i32 %40 to i64
  %42 = getelementptr inbounds [2 x float], ptr %39, i64 %41
  %43 = load i32, ptr %5, align 4, !tbaa !9
  %44 = sext i32 %43 to i64
  %45 = getelementptr inbounds [2 x float], ptr %42, i64 0, i64 %44
  %46 = load float, ptr %45, align 4, !tbaa !11
  %47 = call zeroext i1 @test_eq(float noundef %46, float noundef 0.000000e+00)
  br i1 %47, label %53, label %48

48:                                               ; preds = %38
  %49 = load ptr, ptr @stderr, align 8, !tbaa !5
  %50 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %49, ptr noundef @.str, ptr noundef @.str.1, i32 noundef 247, ptr noundef @.str.6) #4
  %51 = getelementptr inbounds %struct.test_status_t, ptr %2, i32 0, i32 0
  store ptr null, ptr %51, align 8, !tbaa !13
  %52 = getelementptr inbounds %struct.test_status_t, ptr %2, i32 0, i32 1
  store i32 0, ptr %52, align 8, !tbaa !15
  store i32 1, ptr %6, align 4
  br label %67

53:                                               ; preds = %38
  br label %54

54:                                               ; preds = %53
  br label %55

55:                                               ; preds = %54
  br label %56

56:                                               ; preds = %55, %36
  br label %57

57:                                               ; preds = %56
  %58 = load i32, ptr %5, align 4, !tbaa !9
  %59 = add nsw i32 %58, 1
  store i32 %59, ptr %5, align 4, !tbaa !9
  br label %11, !llvm.loop !16

60:                                               ; preds = %11
  br label %61

61:                                               ; preds = %60
  %62 = load i32, ptr %4, align 4, !tbaa !9
  %63 = add nsw i32 %62, 1
  store i32 %63, ptr %4, align 4, !tbaa !9
  br label %7, !llvm.loop !18

64:                                               ; preds = %7
  %65 = getelementptr inbounds %struct.test_status_t, ptr %2, i32 0, i32 0
  store ptr null, ptr %65, align 8, !tbaa !13
  %66 = getelementptr inbounds %struct.test_status_t, ptr %2, i32 0, i32 1
  store i32 1, ptr %66, align 8, !tbaa !15
  store i32 1, ptr %6, align 4
  br label %67

67:                                               ; preds = %64, %48, %29
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #4
  %68 = load { ptr, i32 }, ptr %2, align 8
  ret { ptr, i32 } %68
}

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #4 = { 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 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"float", !7, i64 0}
!13 = !{!14, !6, i64 0}
!14 = !{!"test_status_t", !6, i64 0, !10, i64 8}
!15 = !{!14, !10, i64 8}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}
!18 = distinct !{!18, !17}


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

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

; Function Attrs: nounwind uwtable
define dso_local { ptr, i32 } @test_assert_mat2_eq_identity(ptr nocapture noundef readonly %0) local_unnamed_addr #1 {
  %2 = load float, ptr %0, align 4, !tbaa !5
  %3 = tail call zeroext i1 @test_eq(float noundef %2, float noundef 1.000000e+00)
  br i1 %3, label %10, label %4

4:                                                ; preds = %17, %1
  %5 = load ptr, ptr @stderr, align 8, !tbaa !9
  %6 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %5, ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 245, ptr noundef nonnull @.str.5) #3
  br label %.loopexit

7:                                                ; preds = %.preheader.1, %10
  %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 247, ptr noundef nonnull @.str.6) #3
  br label %.loopexit

10:                                               ; preds = %1
  %11 = getelementptr inbounds i8, ptr %0, i64 4
  %12 = load float, ptr %11, align 4, !tbaa !5
  %13 = tail call zeroext i1 @test_eq(float noundef %12, float noundef 0.000000e+00)
  br i1 %13, label %.preheader.1, label %7

.preheader.1:                                     ; preds = %10
  %14 = getelementptr inbounds i8, ptr %0, i64 8
  %15 = load float, ptr %14, align 4, !tbaa !5
  %16 = tail call zeroext i1 @test_eq(float noundef %15, float noundef 0.000000e+00)
  br i1 %16, label %17, label %7

17:                                               ; preds = %.preheader.1
  %18 = getelementptr inbounds i8, ptr %0, i64 12
  %19 = load float, ptr %18, align 4, !tbaa !5
  %20 = tail call zeroext i1 @test_eq(float noundef %19, float noundef 1.000000e+00)
  br i1 %20, label %.loopexit, label %4

.loopexit:                                        ; preds = %17, %7, %4
  %.sroa.4.0 = phi i32 [ 0, %4 ], [ 0, %7 ], [ 1, %17 ]
  %.fca.1.insert = insertvalue { ptr, i32 } { ptr null, i32 poison }, i32 %.sroa.4.0, 1
  ret { ptr, i32 } %.fca.1.insert
}

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

attributes #0 = { 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 #1 = { 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 = { 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 #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,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,PostOrderFunctionAttrsPass,SCCPPass,SROAPass,SimplifyCFGPass,TailCallElimPass