; 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.PointerPair = type { ptr, ptr }

@pointer_index = external hidden global i32, align 4
@pointer_store = external hidden global [5 x %struct.PointerPair], align 16

; Function Attrs: nounwind uwtable
define dso_local void @UnityPointer_UndoAllSets() #0 {
  br label %1

1:                                                ; preds = %4, %0
  %2 = load i32, ptr @pointer_index, align 4, !tbaa !5
  %3 = icmp sgt i32 %2, 0
  br i1 %3, label %4, label %17

4:                                                ; preds = %1
  %5 = load i32, ptr @pointer_index, align 4, !tbaa !5
  %6 = add nsw i32 %5, -1
  store i32 %6, ptr @pointer_index, align 4, !tbaa !5
  %7 = load i32, ptr @pointer_index, align 4, !tbaa !5
  %8 = sext i32 %7 to i64
  %9 = getelementptr inbounds [5 x %struct.PointerPair], ptr @pointer_store, i64 0, i64 %8
  %10 = getelementptr inbounds %struct.PointerPair, ptr %9, i32 0, i32 1
  %11 = load ptr, ptr %10, align 8, !tbaa !9
  %12 = load i32, ptr @pointer_index, align 4, !tbaa !5
  %13 = sext i32 %12 to i64
  %14 = getelementptr inbounds [5 x %struct.PointerPair], ptr @pointer_store, i64 0, i64 %13
  %15 = getelementptr inbounds %struct.PointerPair, ptr %14, i32 0, i32 0
  %16 = load ptr, ptr %15, align 16, !tbaa !12
  store ptr %11, ptr %16, align 8, !tbaa !13
  br label %1, !llvm.loop !14

17:                                               ; preds = %1
  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" }

!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, !11, i64 8}
!10 = !{!"PointerPair", !11, i64 0, !11, i64 8}
!11 = !{!"any pointer", !7, i64 0}
!12 = !{!10, !11, i64 0}
!13 = !{!11, !11, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"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.PointerPair = type { ptr, ptr }

@pointer_index = external hidden local_unnamed_addr global i32, align 4
@pointer_store = external hidden local_unnamed_addr global [5 x %struct.PointerPair], align 16

; Function Attrs: nofree norecurse nosync nounwind memory(readwrite, argmem: write, inaccessiblemem: none) uwtable
define dso_local void @UnityPointer_UndoAllSets() local_unnamed_addr #0 {
  %pointer_index.promoted = load i32, ptr @pointer_index, align 4, !tbaa !5
  %1 = icmp sgt i32 %pointer_index.promoted, 0
  br i1 %1, label %.lr.ph.preheader, label %26

.lr.ph.preheader:                                 ; preds = %0
  %2 = zext nneg i32 %pointer_index.promoted to i64
  %xtraiter = and i64 %2, 3
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.lr.ph.prol.loopexit, label %.lr.ph.prol

.lr.ph.prol:                                      ; preds = %.lr.ph.preheader, %.lr.ph.prol
  %indvars.iv.prol = phi i64 [ %indvars.iv.next.prol, %.lr.ph.prol ], [ %2, %.lr.ph.preheader ]
  %prol.iter = phi i64 [ %prol.iter.next, %.lr.ph.prol ], [ 0, %.lr.ph.preheader ]
  %indvars.iv.next.prol = add nsw i64 %indvars.iv.prol, -1
  %3 = getelementptr inbounds [5 x %struct.PointerPair], ptr @pointer_store, i64 0, i64 %indvars.iv.next.prol
  %4 = getelementptr inbounds i8, ptr %3, i64 8
  %5 = load ptr, ptr %4, align 8, !tbaa !9
  %6 = load ptr, ptr %3, align 16, !tbaa !12
  store ptr %5, ptr %6, align 8, !tbaa !13
  %prol.iter.next = add i64 %prol.iter, 1
  %prol.iter.cmp.not = icmp eq i64 %prol.iter.next, %xtraiter
  br i1 %prol.iter.cmp.not, label %.lr.ph.prol.loopexit, label %.lr.ph.prol, !llvm.loop !14

.lr.ph.prol.loopexit:                             ; preds = %.lr.ph.prol, %.lr.ph.preheader
  %indvars.iv.unr = phi i64 [ %2, %.lr.ph.preheader ], [ %indvars.iv.next.prol, %.lr.ph.prol ]
  %indvars.iv.next.lcssa.unr = phi i64 [ poison, %.lr.ph.preheader ], [ %indvars.iv.next.prol, %.lr.ph.prol ]
  %7 = icmp ult i32 %pointer_index.promoted, 4
  br i1 %7, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.prol.loopexit, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next.3, %.lr.ph ], [ %indvars.iv.unr, %.lr.ph.prol.loopexit ]
  %indvars.iv.next = add nsw i64 %indvars.iv, -1
  %8 = getelementptr inbounds [5 x %struct.PointerPair], ptr @pointer_store, i64 0, i64 %indvars.iv.next
  %9 = getelementptr inbounds i8, ptr %8, i64 8
  %10 = load ptr, ptr %9, align 8, !tbaa !9
  %11 = load ptr, ptr %8, align 16, !tbaa !12
  store ptr %10, ptr %11, align 8, !tbaa !13
  %indvars.iv.next.1 = add nsw i64 %indvars.iv, -2
  %12 = getelementptr inbounds [5 x %struct.PointerPair], ptr @pointer_store, i64 0, i64 %indvars.iv.next.1
  %13 = getelementptr inbounds i8, ptr %12, i64 8
  %14 = load ptr, ptr %13, align 8, !tbaa !9
  %15 = load ptr, ptr %12, align 16, !tbaa !12
  store ptr %14, ptr %15, align 8, !tbaa !13
  %indvars.iv.next.2 = add nsw i64 %indvars.iv, -3
  %16 = getelementptr inbounds [5 x %struct.PointerPair], ptr @pointer_store, i64 0, i64 %indvars.iv.next.2
  %17 = getelementptr inbounds i8, ptr %16, i64 8
  %18 = load ptr, ptr %17, align 8, !tbaa !9
  %19 = load ptr, ptr %16, align 16, !tbaa !12
  store ptr %18, ptr %19, align 8, !tbaa !13
  %indvars.iv.next.3 = add nsw i64 %indvars.iv, -4
  %20 = getelementptr inbounds [5 x %struct.PointerPair], ptr @pointer_store, i64 0, i64 %indvars.iv.next.3
  %21 = getelementptr inbounds i8, ptr %20, i64 8
  %22 = load ptr, ptr %21, align 8, !tbaa !9
  %23 = load ptr, ptr %20, align 16, !tbaa !12
  store ptr %22, ptr %23, align 8, !tbaa !13
  %24 = icmp ugt i64 %indvars.iv.next.2, 1
  br i1 %24, label %.lr.ph, label %._crit_edge, !llvm.loop !16

._crit_edge:                                      ; preds = %.lr.ph, %.lr.ph.prol.loopexit
  %indvars.iv.next.lcssa = phi i64 [ %indvars.iv.next.lcssa.unr, %.lr.ph.prol.loopexit ], [ %indvars.iv.next.3, %.lr.ph ]
  %25 = trunc nuw nsw i64 %indvars.iv.next.lcssa to i32
  store i32 %25, ptr @pointer_index, align 4, !tbaa !5
  br label %26

26:                                               ; preds = %._crit_edge, %0
  ret void
}

attributes #0 = { nofree norecurse nosync nounwind memory(readwrite, argmem: write, inaccessiblemem: none) 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !11, i64 8}
!10 = !{!"PointerPair", !11, i64 0, !11, i64 8}
!11 = !{!"any pointer", !7, i64 0}
!12 = !{!10, !11, i64 0}
!13 = !{!11, !11, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.unroll.disable"}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InstCombinePass,InstSimplifyPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SimplifyCFGPass