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

; 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 uwtable
define dso_local void @UnityPrintLen(ptr noundef %0, i32 noundef %1) #1 {
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store i32 %1, ptr %4, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #3
  %6 = load ptr, ptr %3, align 8, !tbaa !5
  store ptr %6, ptr %5, align 8, !tbaa !5
  %7 = load ptr, ptr %5, align 8, !tbaa !5
  %8 = icmp ne ptr %7, null
  br i1 %8, label %9, label %69

9:                                                ; preds = %2
  br label %10

10:                                               ; preds = %65, %9
  %11 = load ptr, ptr %5, align 8, !tbaa !5
  %12 = load i8, ptr %11, align 1, !tbaa !11
  %13 = sext i8 %12 to i32
  %14 = icmp ne i32 %13, 0
  br i1 %14, label %15, label %24

15:                                               ; preds = %10
  %16 = load ptr, ptr %5, align 8, !tbaa !5
  %17 = load ptr, ptr %3, align 8, !tbaa !5
  %18 = ptrtoint ptr %16 to i64
  %19 = ptrtoint ptr %17 to i64
  %20 = sub i64 %18, %19
  %21 = trunc i64 %20 to i32
  %22 = load i32, ptr %4, align 4, !tbaa !9
  %23 = icmp ult i32 %21, %22
  br label %24

24:                                               ; preds = %15, %10
  %25 = phi i1 [ false, %10 ], [ %23, %15 ]
  br i1 %25, label %26, label %68

26:                                               ; preds = %24
  %27 = load ptr, ptr %5, align 8, !tbaa !5
  %28 = load i8, ptr %27, align 1, !tbaa !11
  %29 = sext i8 %28 to i32
  %30 = icmp sle i32 %29, 126
  br i1 %30, label %31, label %41

31:                                               ; preds = %26
  %32 = load ptr, ptr %5, align 8, !tbaa !5
  %33 = load i8, ptr %32, align 1, !tbaa !11
  %34 = sext i8 %33 to i32
  %35 = icmp sge i32 %34, 32
  br i1 %35, label %36, label %41

36:                                               ; preds = %31
  %37 = load ptr, ptr %5, align 8, !tbaa !5
  %38 = load i8, ptr %37, align 1, !tbaa !11
  %39 = sext i8 %38 to i32
  %40 = call i32 @putchar(i32 noundef %39)
  br label %65

41:                                               ; preds = %31, %26
  %42 = load ptr, ptr %5, align 8, !tbaa !5
  %43 = load i8, ptr %42, align 1, !tbaa !11
  %44 = sext i8 %43 to i32
  %45 = icmp eq i32 %44, 13
  br i1 %45, label %46, label %49

46:                                               ; preds = %41
  %47 = call i32 @putchar(i32 noundef 92)
  %48 = call i32 @putchar(i32 noundef 114)
  br label %64

49:                                               ; preds = %41
  %50 = load ptr, ptr %5, align 8, !tbaa !5
  %51 = load i8, ptr %50, align 1, !tbaa !11
  %52 = sext i8 %51 to i32
  %53 = icmp eq i32 %52, 10
  br i1 %53, label %54, label %57

54:                                               ; preds = %49
  %55 = call i32 @putchar(i32 noundef 92)
  %56 = call i32 @putchar(i32 noundef 110)
  br label %63

57:                                               ; preds = %49
  %58 = call i32 @putchar(i32 noundef 92)
  %59 = call i32 @putchar(i32 noundef 120)
  %60 = load ptr, ptr %5, align 8, !tbaa !5
  %61 = load i8, ptr %60, align 1, !tbaa !11
  %62 = sext i8 %61 to i64
  call void @UnityPrintNumberHex(i64 noundef %62, i8 noundef signext 2)
  br label %63

63:                                               ; preds = %57, %54
  br label %64

64:                                               ; preds = %63, %46
  br label %65

65:                                               ; preds = %64, %36
  %66 = load ptr, ptr %5, align 8, !tbaa !5
  %67 = getelementptr inbounds i8, ptr %66, i32 1
  store ptr %67, ptr %5, align 8, !tbaa !5
  br label %10, !llvm.loop !12

68:                                               ; preds = %24
  br label %69

69:                                               ; preds = %68, %2
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #3
  ret void
}

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

; Function Attrs: nounwind uwtable
declare dso_local void @UnityPrintNumberHex(i64 noundef, i8 noundef signext) #1

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 = { 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 = !{!7, !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"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"

; Function Attrs: nounwind uwtable
define dso_local void @UnityPrintLen(ptr noundef %0, i32 noundef %1) local_unnamed_addr #0 {
  %.not = icmp eq ptr %0, null
  br i1 %.not, label %.critedge, label %.preheader

.preheader:                                       ; preds = %2
  %3 = ptrtoint ptr %0 to i64
  %4 = load i8, ptr %0, align 1, !tbaa !5
  %.not1522 = icmp ne i8 %4, 0
  %5 = icmp ne i32 %1, 0
  %or.cond23 = and i1 %.not1522, %5
  br i1 %or.cond23, label %.lr.ph, label %.critedge

.lr.ph:                                           ; preds = %.preheader, %21
  %6 = phi i8 [ %23, %21 ], [ %4, %.preheader ]
  %.024 = phi ptr [ %22, %21 ], [ %0, %.preheader ]
  %7 = add i8 %6, -32
  %or.cond21 = icmp ult i8 %7, 95
  br i1 %or.cond21, label %8, label %11

8:                                                ; preds = %.lr.ph
  %9 = zext nneg i8 %6 to i32
  %10 = tail call i32 @putchar(i32 noundef %9)
  br label %21

11:                                               ; preds = %.lr.ph
  %12 = tail call i32 @putchar(i32 noundef 92)
  switch i8 %6, label %17 [
    i8 13, label %13
    i8 10, label %15
  ]

13:                                               ; preds = %11
  %14 = tail call i32 @putchar(i32 noundef 114)
  br label %21

15:                                               ; preds = %11
  %16 = tail call i32 @putchar(i32 noundef 110)
  br label %21

17:                                               ; preds = %11
  %18 = tail call i32 @putchar(i32 noundef 120)
  %19 = load i8, ptr %.024, align 1, !tbaa !5
  %20 = sext i8 %19 to i64
  tail call void @UnityPrintNumberHex(i64 noundef %20, i8 noundef signext 2)
  br label %21

21:                                               ; preds = %13, %17, %15, %8
  %22 = getelementptr inbounds i8, ptr %.024, i64 1
  %23 = load i8, ptr %22, align 1, !tbaa !5
  %.not15 = icmp ne i8 %23, 0
  %24 = ptrtoint ptr %22 to i64
  %25 = sub i64 %24, %3
  %26 = trunc i64 %25 to i32
  %27 = icmp ult i32 %26, %1
  %or.cond = and i1 %.not15, %27
  br i1 %or.cond, label %.lr.ph, label %.critedge, !llvm.loop !8

.critedge:                                        ; preds = %21, %.preheader, %2
  ret void
}

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

; Function Attrs: nounwind uwtable
declare dso_local void @UnityPrintNumberHex(i64 noundef, i8 noundef signext) local_unnamed_addr #0

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 = { 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" }

!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 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}


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