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

; 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] }

@Unity = external dso_local global %struct.UNITY_STORAGE_T, align 8

; 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: noreturn nounwind
declare void @longjmp(ptr noundef, i32 noundef) #1

; Function Attrs: nounwind uwtable
declare hidden void @UnityTestResultsFailBegin(i64 noundef) #2

; Function Attrs: nounwind uwtable
declare hidden void @UnityAddMsgIfSpecified(ptr noundef) #2

; Function Attrs: nounwind uwtable
define dso_local void @UnityAssertEqualString(ptr noundef %0, ptr noundef %1, ptr noundef %2, i64 noundef %3) #2 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i64, align 8
  %9 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store ptr %2, ptr %7, align 8, !tbaa !5
  store i64 %3, ptr %8, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #3
  %10 = load i64, ptr getelementptr inbounds (%struct.UNITY_STORAGE_T, ptr @Unity, i32 0, i32 8), align 8, !tbaa !11
  %11 = icmp ne i64 %10, 0
  br i1 %11, label %15, label %12

12:                                               ; preds = %4
  %13 = load i64, ptr getelementptr inbounds (%struct.UNITY_STORAGE_T, ptr @Unity, i32 0, i32 9), align 8, !tbaa !13
  %14 = icmp ne i64 %13, 0
  br i1 %14, label %15, label %16

15:                                               ; preds = %12, %4
  call void @longjmp(ptr noundef getelementptr inbounds (%struct.UNITY_STORAGE_T, ptr @Unity, i32 0, i32 10), i32 noundef 1) #4
  unreachable

16:                                               ; preds = %12
  %17 = load ptr, ptr %5, align 8, !tbaa !5
  %18 = icmp ne ptr %17, null
  br i1 %18, label %19, label %61

19:                                               ; preds = %16
  %20 = load ptr, ptr %6, align 8, !tbaa !5
  %21 = icmp ne ptr %20, null
  br i1 %21, label %22, label %61

22:                                               ; preds = %19
  store i32 0, ptr %9, align 4, !tbaa !14
  br label %23

23:                                               ; preds = %57, %22
  %24 = load ptr, ptr %5, align 8, !tbaa !5
  %25 = load i32, ptr %9, align 4, !tbaa !14
  %26 = zext i32 %25 to i64
  %27 = getelementptr inbounds i8, ptr %24, i64 %26
  %28 = load i8, ptr %27, align 1, !tbaa !16
  %29 = sext i8 %28 to i32
  %30 = icmp ne i32 %29, 0
  br i1 %30, label %39, label %31

31:                                               ; preds = %23
  %32 = load ptr, ptr %6, align 8, !tbaa !5
  %33 = load i32, ptr %9, align 4, !tbaa !14
  %34 = zext i32 %33 to i64
  %35 = getelementptr inbounds i8, ptr %32, i64 %34
  %36 = load i8, ptr %35, align 1, !tbaa !16
  %37 = sext i8 %36 to i32
  %38 = icmp ne i32 %37, 0
  br label %39

39:                                               ; preds = %31, %23
  %40 = phi i1 [ true, %23 ], [ %38, %31 ]
  br i1 %40, label %41, label %60

41:                                               ; preds = %39
  %42 = load ptr, ptr %5, align 8, !tbaa !5
  %43 = load i32, ptr %9, align 4, !tbaa !14
  %44 = zext i32 %43 to i64
  %45 = getelementptr inbounds i8, ptr %42, i64 %44
  %46 = load i8, ptr %45, align 1, !tbaa !16
  %47 = sext i8 %46 to i32
  %48 = load ptr, ptr %6, align 8, !tbaa !5
  %49 = load i32, ptr %9, align 4, !tbaa !14
  %50 = zext i32 %49 to i64
  %51 = getelementptr inbounds i8, ptr %48, i64 %50
  %52 = load i8, ptr %51, align 1, !tbaa !16
  %53 = sext i8 %52 to i32
  %54 = icmp ne i32 %47, %53
  br i1 %54, label %55, label %56

55:                                               ; preds = %41
  store i64 1, ptr getelementptr inbounds (%struct.UNITY_STORAGE_T, ptr @Unity, i32 0, i32 8), align 8, !tbaa !11
  br label %60

56:                                               ; preds = %41
  br label %57

57:                                               ; preds = %56
  %58 = load i32, ptr %9, align 4, !tbaa !14
  %59 = add i32 %58, 1
  store i32 %59, ptr %9, align 4, !tbaa !14
  br label %23, !llvm.loop !17

60:                                               ; preds = %55, %39
  br label %67

61:                                               ; preds = %19, %16
  %62 = load ptr, ptr %5, align 8, !tbaa !5
  %63 = load ptr, ptr %6, align 8, !tbaa !5
  %64 = icmp ne ptr %62, %63
  br i1 %64, label %65, label %66

65:                                               ; preds = %61
  store i64 1, ptr getelementptr inbounds (%struct.UNITY_STORAGE_T, ptr @Unity, i32 0, i32 8), align 8, !tbaa !11
  br label %66

66:                                               ; preds = %65, %61
  br label %67

67:                                               ; preds = %66, %60
  %68 = load i64, ptr getelementptr inbounds (%struct.UNITY_STORAGE_T, ptr @Unity, i32 0, i32 8), align 8, !tbaa !11
  %69 = icmp ne i64 %68, 0
  br i1 %69, label %70, label %75

70:                                               ; preds = %67
  %71 = load i64, ptr %8, align 8, !tbaa !9
  call void @UnityTestResultsFailBegin(i64 noundef %71)
  %72 = load ptr, ptr %5, align 8, !tbaa !5
  %73 = load ptr, ptr %6, align 8, !tbaa !5
  call void @UnityPrintExpectedAndActualStrings(ptr noundef %72, ptr noundef %73)
  %74 = load ptr, ptr %7, align 8, !tbaa !5
  call void @UnityAddMsgIfSpecified(ptr noundef %74)
  store i64 1, ptr getelementptr inbounds (%struct.UNITY_STORAGE_T, ptr @Unity, i32 0, i32 8), align 8, !tbaa !11
  call void @longjmp(ptr noundef getelementptr inbounds (%struct.UNITY_STORAGE_T, ptr @Unity, i32 0, i32 10), i32 noundef 1) #4
  unreachable

75:                                               ; preds = %67
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #3
  ret void
}

; Function Attrs: nounwind uwtable
declare hidden void @UnityPrintExpectedAndActualStrings(ptr noundef, ptr noundef) #2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { noreturn 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 }
attributes #4 = { noreturn 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 = !{!"long", !7, i64 0}
!11 = !{!12, !10, i64 64}
!12 = !{!"UNITY_STORAGE_T", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !10, i64 56, !10, i64 64, !10, i64 72, !7, i64 80}
!13 = !{!12, !10, i64 72}
!14 = !{!15, !15, i64 0}
!15 = !{!"int", !7, i64 0}
!16 = !{!7, !7, i64 0}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}


; 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] }

@Unity = external dso_local global %struct.UNITY_STORAGE_T, align 8

; Function Attrs: noreturn nounwind
declare void @longjmp(ptr noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden void @UnityTestResultsFailBegin(i64 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden void @UnityAddMsgIfSpecified(ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local void @UnityAssertEqualString(ptr noundef %0, ptr noundef %1, ptr noundef %2, i64 noundef %3) local_unnamed_addr #1 {
  %5 = load i64, ptr getelementptr inbounds (i8, ptr @Unity, i64 64), align 8, !tbaa !5
  %6 = icmp ne i64 %5, 0
  %7 = load i64, ptr getelementptr inbounds (i8, ptr @Unity, i64 72), align 8
  %8 = icmp ne i64 %7, 0
  %or.cond = select i1 %6, i1 true, i1 %8
  br i1 %or.cond, label %9, label %10

9:                                                ; preds = %4
  tail call void @longjmp(ptr noundef nonnull getelementptr inbounds (i8, ptr @Unity, i64 80), i32 noundef 1) #2
  unreachable

10:                                               ; preds = %4
  %11 = icmp ne ptr %0, null
  %12 = icmp ne ptr %1, null
  %or.cond3 = and i1 %11, %12
  br i1 %or.cond3, label %.preheader, label %19

.preheader:                                       ; preds = %10, %.critedge
  %.0 = phi i32 [ %18, %.critedge ], [ 0, %10 ]
  %13 = zext i32 %.0 to i64
  %14 = getelementptr inbounds i8, ptr %0, i64 %13
  %15 = load i8, ptr %14, align 1, !tbaa !11
  %.not21 = icmp eq i8 %15, 0
  %16 = getelementptr inbounds i8, ptr %1, i64 %13
  %17 = load i8, ptr %16, align 1, !tbaa !11
  %.not22 = icmp eq i8 %17, 0
  %or.cond26 = select i1 %.not21, i1 %.not22, i1 false
  br i1 %or.cond26, label %.loopexit, label %.critedge

.critedge:                                        ; preds = %.preheader
  %.not23 = icmp eq i8 %15, %17
  %18 = add i32 %.0, 1
  br i1 %.not23, label %.preheader, label %.thread, !llvm.loop !12

19:                                               ; preds = %10
  %.not = icmp eq ptr %0, %1
  br i1 %.not, label %.loopexit, label %.thread

.thread:                                          ; preds = %.critedge, %19
  store i64 1, ptr getelementptr inbounds (i8, ptr @Unity, i64 64), align 8, !tbaa !5
  tail call void @UnityTestResultsFailBegin(i64 noundef %3)
  tail call void @UnityPrintExpectedAndActualStrings(ptr noundef %0, ptr noundef %1)
  tail call void @UnityAddMsgIfSpecified(ptr noundef %2)
  store i64 1, ptr getelementptr inbounds (i8, ptr @Unity, i64 64), align 8, !tbaa !5
  tail call void @longjmp(ptr noundef nonnull getelementptr inbounds (i8, ptr @Unity, i64 80), i32 noundef 1) #2
  unreachable

.loopexit:                                        ; preds = %.preheader, %19
  ret void
}

; Function Attrs: nounwind uwtable
declare hidden void @UnityPrintExpectedAndActualStrings(ptr noundef, ptr noundef) local_unnamed_addr #1

attributes #0 = { noreturn 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 = { noreturn 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, !10, i64 64}
!6 = !{!"UNITY_STORAGE_T", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !10, i64 56, !10, i64 64, !10, i64 72, !8, i64 80}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"long", !8, i64 0}
!11 = !{!8, !8, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: BDCEPass,EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SCCPPass,SROAPass,SimplifyCFGPass,TailCallElimPass