; LLVM IR from lichen-community-systems/signaletic :: libsignaletic/tests/vendor/unity/test/tests (test_unity_arrays)

; 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.UNITY_STORAGE_T = type { ptr, ptr, ptr, ptr, i64, i64, i64, i64, i64, i64, [1 x %struct.__jmp_buf_tag] }
%struct.__jmp_buf_tag = type { [8 x i64], i32, %struct.__sigset_t }
%struct.__sigset_t = type { [16 x i64] }

@SetToOneMeanWeAlreadyCheckedThisGuy = external hidden global i32, align 4
@Unity = external global %struct.UNITY_STORAGE_T, align 8
@.str.3 = external hidden unnamed_addr constant [53 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local void @startPutcharSpy() #0

; Function Attrs: nounwind uwtable
declare dso_local void @endPutcharSpy() #0

declare void @UnityPrint(ptr noundef) #1

; Function Attrs: inlinehint nounwind uwtable
declare i32 @putchar(i32 noundef) #2

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

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

; Function Attrs: nounwind returns_twice
declare i32 @_setjmp(ptr noundef) #4

declare void @UnityPrintNumberUnsigned(i64 noundef) #1

declare void @UnityAssertEqualIntArray(ptr noundef, ptr noundef, i32 noundef, ptr noundef, i64 noundef, i32 noundef, i32 noundef) #1

; Function Attrs: nounwind uwtable
define dso_local void @testNotEqualPtrArraysNullExpected() #0 {
  %1 = alloca i8, align 1
  %2 = alloca i8, align 1
  %3 = alloca ptr, align 8
  %4 = alloca [2 x ptr], align 16
  call void @llvm.lifetime.start.p0(i64 1, ptr %1) #5
  store i8 1, ptr %1, align 1, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1, ptr %2) #5
  store i8 2, ptr %2, align 1, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #5
  store ptr null, ptr %3, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 16, ptr %4) #5
  store ptr %1, ptr %4, align 8, !tbaa !8
  %5 = getelementptr inbounds ptr, ptr %4, i64 1
  store ptr %2, ptr %5, align 8, !tbaa !8
  call void @startPutcharSpy()
  %6 = call i32 @_setjmp(ptr noundef getelementptr inbounds (%struct.UNITY_STORAGE_T, ptr @Unity, i32 0, i32 10)) #6
  %7 = icmp eq i32 %6, 0
  br i1 %7, label %8, label %11

8:                                                ; preds = %0
  %9 = load ptr, ptr %3, align 8, !tbaa !8
  %10 = getelementptr inbounds [2 x ptr], ptr %4, i64 0, i64 0
  call void @UnityAssertEqualIntArray(ptr noundef %9, ptr noundef %10, i32 noundef 2, ptr noundef null, i64 noundef 1770, i32 noundef 72, i32 noundef 1)
  br label %11

11:                                               ; preds = %8, %0
  call void @endPutcharSpy()
  %12 = load i64, ptr getelementptr inbounds (%struct.UNITY_STORAGE_T, ptr @Unity, i32 0, i32 8), align 8, !tbaa !10
  %13 = icmp eq i64 %12, 1
  %14 = zext i1 %13 to i64
  %15 = select i1 %13, i32 0, i32 1
  %16 = sext i32 %15 to i64
  store i64 %16, ptr getelementptr inbounds (%struct.UNITY_STORAGE_T, ptr @Unity, i32 0, i32 8), align 8, !tbaa !10
  %17 = load i64, ptr getelementptr inbounds (%struct.UNITY_STORAGE_T, ptr @Unity, i32 0, i32 8), align 8, !tbaa !10
  %18 = icmp eq i64 %17, 1
  br i1 %18, label %19, label %24

19:                                               ; preds = %11
  store i32 1, ptr @SetToOneMeanWeAlreadyCheckedThisGuy, align 4, !tbaa !13
  %20 = load i64, ptr getelementptr inbounds (%struct.UNITY_STORAGE_T, ptr @Unity, i32 0, i32 4), align 8, !tbaa !15
  call void @UnityPrintNumberUnsigned(i64 noundef %20)
  %21 = call i32 @putchar(i32 noundef 58)
  %22 = load ptr, ptr getelementptr inbounds (%struct.UNITY_STORAGE_T, ptr @Unity, i32 0, i32 1), align 8, !tbaa !16
  call void @UnityPrint(ptr noundef %22)
  call void @UnityPrint(ptr noundef @.str.3)
  %23 = call i32 @putchar(i32 noundef 10)
  br label %24

24:                                               ; preds = %19, %11
  call void @llvm.lifetime.end.p0(i64 16, ptr %4) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %2) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %1) #5
  ret void
}

attributes #0 = { 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 #1 = { "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 = { inlinehint 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { nounwind returns_twice "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 }
attributes #6 = { nounwind returns_twice }

!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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"any pointer", !6, i64 0}
!10 = !{!11, !12, i64 64}
!11 = !{!"UNITY_STORAGE_T", !9, i64 0, !9, i64 8, !9, i64 16, !9, i64 24, !12, i64 32, !12, i64 40, !12, i64 48, !12, i64 56, !12, i64 64, !12, i64 72, !6, i64 80}
!12 = !{!"long", !6, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"int", !6, i64 0}
!15 = !{!11, !12, i64 32}
!16 = !{!11, !9, 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"

%struct.UNITY_STORAGE_T = type { ptr, ptr, ptr, ptr, i64, i64, i64, i64, i64, i64, [1 x %struct.__jmp_buf_tag] }
%struct.__jmp_buf_tag = type { [8 x i64], i32, %struct.__sigset_t }
%struct.__sigset_t = type { [16 x i64] }

@SetToOneMeanWeAlreadyCheckedThisGuy = external hidden local_unnamed_addr global i32, align 4
@Unity = external global %struct.UNITY_STORAGE_T, align 8
@.str.3 = external hidden unnamed_addr constant [53 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local void @startPutcharSpy() local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local void @endPutcharSpy() local_unnamed_addr #0

declare void @UnityPrint(ptr noundef) local_unnamed_addr #1

; Function Attrs: inlinehint nofree nounwind uwtable
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #2

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

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

; Function Attrs: nounwind returns_twice
declare i32 @_setjmp(ptr noundef) local_unnamed_addr #4

declare void @UnityPrintNumberUnsigned(i64 noundef) local_unnamed_addr #1

declare void @UnityAssertEqualIntArray(ptr noundef, ptr noundef, i32 noundef, ptr noundef, i64 noundef, i32 noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local void @testNotEqualPtrArraysNullExpected() local_unnamed_addr #0 {
  %1 = alloca i8, align 1
  %2 = alloca i8, align 1
  %3 = alloca [2 x ptr], align 16
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %1) #5
  store i8 1, ptr %1, align 1, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %2) #5
  store i8 2, ptr %2, align 1, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %3) #5
  store ptr %1, ptr %3, align 16, !tbaa !8
  %4 = getelementptr inbounds i8, ptr %3, i64 8
  store ptr %2, ptr %4, align 8, !tbaa !8
  call void @startPutcharSpy()
  %5 = call i32 @_setjmp(ptr noundef nonnull getelementptr inbounds (i8, ptr @Unity, i64 80)) #6
  %6 = icmp eq i32 %5, 0
  br i1 %6, label %7, label %8

7:                                                ; preds = %0
  call void @UnityAssertEqualIntArray(ptr noundef null, ptr noundef nonnull %3, i32 noundef 2, ptr noundef null, i64 noundef 1770, i32 noundef 72, i32 noundef 1) #5
  br label %8

8:                                                ; preds = %7, %0
  call void @endPutcharSpy()
  %9 = load i64, ptr getelementptr inbounds (i8, ptr @Unity, i64 64), align 8, !tbaa !10
  %10 = icmp ne i64 %9, 1
  %11 = zext i1 %10 to i64
  store i64 %11, ptr getelementptr inbounds (i8, ptr @Unity, i64 64), align 8, !tbaa !10
  br i1 %10, label %12, label %17

12:                                               ; preds = %8
  store i32 1, ptr @SetToOneMeanWeAlreadyCheckedThisGuy, align 4, !tbaa !13
  %13 = load i64, ptr getelementptr inbounds (i8, ptr @Unity, i64 32), align 8, !tbaa !15
  call void @UnityPrintNumberUnsigned(i64 noundef %13) #5
  %14 = call i32 @putchar(i32 noundef 58)
  %15 = load ptr, ptr getelementptr inbounds (i8, ptr @Unity, i64 8), align 8, !tbaa !16
  call void @UnityPrint(ptr noundef %15) #5
  call void @UnityPrint(ptr noundef nonnull @.str.3) #5
  %16 = call i32 @putchar(i32 noundef 10)
  br label %17

17:                                               ; preds = %12, %8
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %3) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %2) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %1) #5
  ret void
}

attributes #0 = { 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 #1 = { "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 = { inlinehint 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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { nounwind returns_twice "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 }
attributes #6 = { nounwind returns_twice }

!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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"any pointer", !6, i64 0}
!10 = !{!11, !12, i64 64}
!11 = !{!"UNITY_STORAGE_T", !9, i64 0, !9, i64 8, !9, i64 16, !9, i64 24, !12, i64 32, !12, i64 40, !12, i64 48, !12, i64 56, !12, i64 64, !12, i64 72, !6, i64 80}
!12 = !{!"long", !6, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"int", !6, i64 0}
!15 = !{!11, !12, i64 32}
!16 = !{!11, !9, i64 8}


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