; LLVM IR from ryanlayer/giggle :: test/unit/unity (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 = 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, align 8
@UnityStrExpected = external hidden constant [11 x i8], align 1
@UnityStrWas = external hidden constant [6 x i8], align 1
@UnityStrDelta = external hidden constant [26 x i8], align 16

; Function Attrs: nounwind uwtable
declare dso_local void @UnityPrint(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local void @UnityPrintNumberByStyle(i64 noundef, i32 noundef) #0

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

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

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

; Function Attrs: nounwind uwtable
define dso_local void @UnityAssertNumbersWithin(i64 noundef %0, i64 noundef %1, i64 noundef %2, ptr noundef %3, i64 noundef %4, i32 noundef %5) #0 {
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  %9 = alloca i64, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i64, align 8
  %12 = alloca i32, align 4
  store i64 %0, ptr %7, align 8, !tbaa !5
  store i64 %1, ptr %8, align 8, !tbaa !5
  store i64 %2, ptr %9, align 8, !tbaa !5
  store ptr %3, ptr %10, align 8, !tbaa !9
  store i64 %4, ptr %11, align 8, !tbaa !5
  store i32 %5, ptr %12, align 4, !tbaa !11
  %13 = load i64, ptr getelementptr inbounds (%struct._Unity, ptr @Unity, i32 0, i32 8), align 8, !tbaa !13
  %14 = icmp ne i64 %13, 0
  br i1 %14, label %18, label %15

15:                                               ; preds = %6
  %16 = load i64, ptr getelementptr inbounds (%struct._Unity, ptr @Unity, i32 0, i32 9), align 8, !tbaa !15
  %17 = icmp ne i64 %16, 0
  br i1 %17, label %18, label %19

18:                                               ; preds = %15, %6
  br label %77

19:                                               ; preds = %15
  %20 = load i32, ptr %12, align 4, !tbaa !11
  %21 = and i32 %20, 16
  %22 = icmp eq i32 %21, 16
  br i1 %22, label %23, label %44

23:                                               ; preds = %19
  %24 = load i64, ptr %9, align 8, !tbaa !5
  %25 = load i64, ptr %8, align 8, !tbaa !5
  %26 = icmp sgt i64 %24, %25
  br i1 %26, label %27, label %35

27:                                               ; preds = %23
  %28 = load i64, ptr %9, align 8, !tbaa !5
  %29 = load i64, ptr %8, align 8, !tbaa !5
  %30 = sub nsw i64 %28, %29
  %31 = load i64, ptr %7, align 8, !tbaa !5
  %32 = icmp ugt i64 %30, %31
  %33 = zext i1 %32 to i32
  %34 = sext i32 %33 to i64
  store i64 %34, ptr getelementptr inbounds (%struct._Unity, ptr @Unity, i32 0, i32 8), align 8, !tbaa !13
  br label %43

35:                                               ; preds = %23
  %36 = load i64, ptr %8, align 8, !tbaa !5
  %37 = load i64, ptr %9, align 8, !tbaa !5
  %38 = sub nsw i64 %36, %37
  %39 = load i64, ptr %7, align 8, !tbaa !5
  %40 = icmp ugt i64 %38, %39
  %41 = zext i1 %40 to i32
  %42 = sext i32 %41 to i64
  store i64 %42, ptr getelementptr inbounds (%struct._Unity, ptr @Unity, i32 0, i32 8), align 8, !tbaa !13
  br label %43

43:                                               ; preds = %35, %27
  br label %65

44:                                               ; preds = %19
  %45 = load i64, ptr %9, align 8, !tbaa !5
  %46 = load i64, ptr %8, align 8, !tbaa !5
  %47 = icmp ugt i64 %45, %46
  br i1 %47, label %48, label %56

48:                                               ; preds = %44
  %49 = load i64, ptr %9, align 8, !tbaa !5
  %50 = load i64, ptr %8, align 8, !tbaa !5
  %51 = sub nsw i64 %49, %50
  %52 = load i64, ptr %7, align 8, !tbaa !5
  %53 = icmp ugt i64 %51, %52
  %54 = zext i1 %53 to i32
  %55 = sext i32 %54 to i64
  store i64 %55, ptr getelementptr inbounds (%struct._Unity, ptr @Unity, i32 0, i32 8), align 8, !tbaa !13
  br label %64

56:                                               ; preds = %44
  %57 = load i64, ptr %8, align 8, !tbaa !5
  %58 = load i64, ptr %9, align 8, !tbaa !5
  %59 = sub nsw i64 %57, %58
  %60 = load i64, ptr %7, align 8, !tbaa !5
  %61 = icmp ugt i64 %59, %60
  %62 = zext i1 %61 to i32
  %63 = sext i32 %62 to i64
  store i64 %63, ptr getelementptr inbounds (%struct._Unity, ptr @Unity, i32 0, i32 8), align 8, !tbaa !13
  br label %64

64:                                               ; preds = %56, %48
  br label %65

65:                                               ; preds = %64, %43
  %66 = load i64, ptr getelementptr inbounds (%struct._Unity, ptr @Unity, i32 0, i32 8), align 8, !tbaa !13
  %67 = icmp ne i64 %66, 0
  br i1 %67, label %68, label %77

68:                                               ; preds = %65
  %69 = load i64, ptr %11, align 8, !tbaa !5
  call void @UnityTestResultsFailBegin(i64 noundef %69)
  call void @UnityPrint(ptr noundef @UnityStrDelta)
  %70 = load i64, ptr %7, align 8, !tbaa !5
  %71 = load i32, ptr %12, align 4, !tbaa !11
  call void @UnityPrintNumberByStyle(i64 noundef %70, i32 noundef %71)
  call void @UnityPrint(ptr noundef @UnityStrExpected)
  %72 = load i64, ptr %8, align 8, !tbaa !5
  %73 = load i32, ptr %12, align 4, !tbaa !11
  call void @UnityPrintNumberByStyle(i64 noundef %72, i32 noundef %73)
  call void @UnityPrint(ptr noundef @UnityStrWas)
  %74 = load i64, ptr %9, align 8, !tbaa !5
  %75 = load i32, ptr %12, align 4, !tbaa !11
  call void @UnityPrintNumberByStyle(i64 noundef %74, i32 noundef %75)
  %76 = load ptr, ptr %10, align 8, !tbaa !9
  call void @UnityAddMsgIfSpecified(ptr noundef %76)
  store i64 1, ptr getelementptr inbounds (%struct._Unity, ptr @Unity, i32 0, i32 8), align 8, !tbaa !13
  call void @longjmp(ptr noundef getelementptr inbounds (%struct._Unity, ptr @Unity, i32 0, i32 10), i32 noundef 1) #2
  unreachable

77:                                               ; preds = %65, %18
  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 = { 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 = { 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 = !{!"long", !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}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !6, i64 64}
!14 = !{!"_Unity", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !7, i64 80}
!15 = !{!14, !6, i64 72}


; 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 = 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, align 8
@UnityStrExpected = external hidden constant [11 x i8], align 1
@UnityStrWas = external hidden constant [6 x i8], align 1
@UnityStrDelta = external hidden constant [26 x i8], align 16

; Function Attrs: nounwind uwtable
declare dso_local void @UnityPrint(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local void @UnityPrintNumberByStyle(i64 noundef, i32 noundef) local_unnamed_addr #0

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

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

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

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

11:                                               ; preds = %6
  %12 = and i32 %5, 16
  %.not = icmp eq i32 %12, 0
  br i1 %.not, label %19, label %13

13:                                               ; preds = %11
  %14 = icmp sgt i64 %2, %1
  br i1 %14, label %15, label %17

15:                                               ; preds = %13
  %16 = sub nsw i64 %2, %1
  br label %25

17:                                               ; preds = %13
  %18 = sub nsw i64 %1, %2
  br label %25

19:                                               ; preds = %11
  %20 = icmp ugt i64 %2, %1
  br i1 %20, label %21, label %23

21:                                               ; preds = %19
  %22 = sub nsw i64 %2, %1
  br label %25

23:                                               ; preds = %19
  %24 = sub nsw i64 %1, %2
  br label %25

25:                                               ; preds = %21, %23, %15, %17
  %.sink = phi i64 [ %22, %21 ], [ %24, %23 ], [ %16, %15 ], [ %18, %17 ]
  %26 = icmp ugt i64 %.sink, %0
  %27 = zext i1 %26 to i64
  store i64 %27, ptr getelementptr inbounds (i8, ptr @Unity, i64 64), align 8, !tbaa !5
  br i1 %26, label %28, label %29

28:                                               ; preds = %25
  tail call void @UnityTestResultsFailBegin(i64 noundef %4)
  tail call void @UnityPrint(ptr noundef nonnull @UnityStrDelta)
  tail call void @UnityPrintNumberByStyle(i64 noundef %0, i32 noundef %5)
  tail call void @UnityPrint(ptr noundef nonnull @UnityStrExpected)
  tail call void @UnityPrintNumberByStyle(i64 noundef %1, i32 noundef %5)
  tail call void @UnityPrint(ptr noundef nonnull @UnityStrWas)
  tail call void @UnityPrintNumberByStyle(i64 noundef %2, i32 noundef %5)
  tail call void @UnityAddMsgIfSpecified(ptr noundef %3)
  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

29:                                               ; preds = %6, %25
  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 = { 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 = { 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", !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}


; Effective O3 passes: GlobalOptPass,IPSCCPPass,InstCombinePass,JumpThreadingPass,SROAPass,SimplifyCFGPass,TailCallElimPass