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

; 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_FIXTURE_T = type { i32, i32, i32, ptr, ptr }
%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] }

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

; Function Attrs: nounwind uwtable
define dso_local i32 @UnityMain(i32 noundef %0, ptr noundef %1, ptr noundef %2) #0 {
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  store i32 %0, ptr %5, align 4, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !9
  store ptr %2, ptr %7, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  %11 = load i32, ptr %5, align 4, !tbaa !5
  %12 = load ptr, ptr %6, align 8, !tbaa !9
  %13 = call i32 @UnityGetCommandLineOptions(i32 noundef %11, ptr noundef %12)
  store i32 %13, ptr %8, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  %14 = load i32, ptr %8, align 4, !tbaa !5
  %15 = icmp ne i32 %14, 0
  br i1 %15, label %16, label %18

16:                                               ; preds = %3
  %17 = load i32, ptr %8, align 4, !tbaa !5
  store i32 %17, ptr %4, align 4
  store i32 1, ptr %10, align 4
  br label %41

18:                                               ; preds = %3
  store i32 0, ptr %9, align 4, !tbaa !5
  br label %19

19:                                               ; preds = %35, %18
  %20 = load i32, ptr %9, align 4, !tbaa !5
  %21 = load i32, ptr getelementptr inbounds (%struct.UNITY_FIXTURE_T, ptr @UnityFixture, i32 0, i32 2), align 8, !tbaa !11
  %22 = icmp ult i32 %20, %21
  br i1 %22, label %23, label %38

23:                                               ; preds = %19
  %24 = load ptr, ptr %6, align 8, !tbaa !9
  %25 = getelementptr inbounds ptr, ptr %24, i64 0
  %26 = load ptr, ptr %25, align 8, !tbaa !9
  call void @UnityBegin(ptr noundef %26)
  %27 = load i32, ptr %9, align 4, !tbaa !5
  call void @announceTestRun(i32 noundef %27)
  %28 = load ptr, ptr %7, align 8, !tbaa !9
  call void %28()
  %29 = load i32, ptr @UnityFixture, align 8, !tbaa !13
  %30 = icmp ne i32 %29, 0
  br i1 %30, label %33, label %31

31:                                               ; preds = %23
  %32 = call i32 @putchar(i32 noundef 10)
  br label %33

33:                                               ; preds = %31, %23
  %34 = call i32 @UnityEnd()
  br label %35

35:                                               ; preds = %33
  %36 = load i32, ptr %9, align 4, !tbaa !5
  %37 = add i32 %36, 1
  store i32 %37, ptr %9, align 4, !tbaa !5
  br label %19, !llvm.loop !14

38:                                               ; preds = %19
  %39 = load i64, ptr getelementptr inbounds (%struct.UNITY_STORAGE_T, ptr @Unity, i32 0, i32 6), align 8, !tbaa !16
  %40 = trunc i64 %39 to i32
  store i32 %40, ptr %4, align 4
  store i32 1, ptr %10, align 4
  br label %41

41:                                               ; preds = %38, %16
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  %42 = load i32, ptr %4, align 4
  ret i32 %42
}

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

; Function Attrs: nounwind uwtable
declare dso_local i32 @UnityGetCommandLineOptions(i32 noundef, ptr noundef) #0

declare void @UnityBegin(ptr noundef) #2

; Function Attrs: nounwind uwtable
declare hidden void @announceTestRun(i32 noundef) #0

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

declare i32 @UnityEnd() #2

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

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


; 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_FIXTURE_T = type { i32, i32, i32, ptr, ptr }
%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] }

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

; Function Attrs: nounwind uwtable
define dso_local i32 @UnityMain(i32 noundef %0, ptr noundef %1, ptr nocapture noundef readonly %2) local_unnamed_addr #0 {
  %4 = tail call i32 @UnityGetCommandLineOptions(i32 noundef %0, ptr noundef %1)
  %.not = icmp eq i32 %4, 0
  br i1 %.not, label %.preheader, label %17

.preheader:                                       ; preds = %3
  %5 = load i32, ptr getelementptr inbounds (i8, ptr @UnityFixture, i64 8), align 8, !tbaa !5
  %.not13 = icmp eq i32 %5, 0
  br i1 %.not13, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %.preheader, %10
  %.012 = phi i32 [ %12, %10 ], [ 0, %.preheader ]
  %6 = load ptr, ptr %1, align 8, !tbaa !11
  tail call void @UnityBegin(ptr noundef %6) #3
  tail call void @announceTestRun(i32 noundef %.012)
  tail call void %2() #3
  %7 = load i32, ptr @UnityFixture, align 8, !tbaa !12
  %.not11 = icmp eq i32 %7, 0
  br i1 %.not11, label %8, label %10

8:                                                ; preds = %.lr.ph
  %9 = tail call i32 @putchar(i32 noundef 10)
  br label %10

10:                                               ; preds = %8, %.lr.ph
  %11 = tail call i32 @UnityEnd() #3
  %12 = add nuw i32 %.012, 1
  %13 = load i32, ptr getelementptr inbounds (i8, ptr @UnityFixture, i64 8), align 8, !tbaa !5
  %14 = icmp ult i32 %12, %13
  br i1 %14, label %.lr.ph, label %._crit_edge, !llvm.loop !13

._crit_edge:                                      ; preds = %10, %.preheader
  %15 = load i64, ptr getelementptr inbounds (i8, ptr @Unity, i64 48), align 8, !tbaa !15
  %16 = trunc i64 %15 to i32
  br label %17

17:                                               ; preds = %3, %._crit_edge
  %.09 = phi i32 [ %16, %._crit_edge ], [ %4, %3 ]
  ret i32 %.09
}

; Function Attrs: nounwind uwtable
declare dso_local i32 @UnityGetCommandLineOptions(i32 noundef, ptr noundef) local_unnamed_addr #0

declare void @UnityBegin(ptr noundef) local_unnamed_addr #1

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

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

declare i32 @UnityEnd() local_unnamed_addr #1

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


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