; LLVM IR from ssvb/tinymembench :: util (aligned_block_copy)

; 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: nounwind uwtable
define dso_local void @aligned_block_copy(ptr noalias noundef %0, ptr noalias noundef %1, i32 noundef %2) #0 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca i64, align 8
  %9 = alloca i64, align 8
  %10 = alloca i64, align 8
  %11 = alloca i64, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store i32 %2, ptr %6, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #2
  %12 = load ptr, ptr %4, align 8, !tbaa !5
  store ptr %12, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #2
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #2
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #2
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #2
  br label %13

13:                                               ; preds = %17, %3
  %14 = load i32, ptr %6, align 4, !tbaa !9
  %15 = sub nsw i32 %14, 64
  store i32 %15, ptr %6, align 4, !tbaa !9
  %16 = icmp sge i32 %15, 0
  br i1 %16, label %17, label %66

17:                                               ; preds = %13
  %18 = load ptr, ptr %5, align 8, !tbaa !5
  %19 = getelementptr inbounds i64, ptr %18, i32 1
  store ptr %19, ptr %5, align 8, !tbaa !5
  %20 = load i64, ptr %18, align 8, !tbaa !11
  store i64 %20, ptr %8, align 8, !tbaa !11
  %21 = load ptr, ptr %5, align 8, !tbaa !5
  %22 = getelementptr inbounds i64, ptr %21, i32 1
  store ptr %22, ptr %5, align 8, !tbaa !5
  %23 = load i64, ptr %21, align 8, !tbaa !11
  store i64 %23, ptr %9, align 8, !tbaa !11
  %24 = load ptr, ptr %5, align 8, !tbaa !5
  %25 = getelementptr inbounds i64, ptr %24, i32 1
  store ptr %25, ptr %5, align 8, !tbaa !5
  %26 = load i64, ptr %24, align 8, !tbaa !11
  store i64 %26, ptr %10, align 8, !tbaa !11
  %27 = load ptr, ptr %5, align 8, !tbaa !5
  %28 = getelementptr inbounds i64, ptr %27, i32 1
  store ptr %28, ptr %5, align 8, !tbaa !5
  %29 = load i64, ptr %27, align 8, !tbaa !11
  store i64 %29, ptr %11, align 8, !tbaa !11
  %30 = load i64, ptr %8, align 8, !tbaa !11
  %31 = load ptr, ptr %7, align 8, !tbaa !5
  %32 = getelementptr inbounds i64, ptr %31, i32 1
  store ptr %32, ptr %7, align 8, !tbaa !5
  store volatile i64 %30, ptr %31, align 8, !tbaa !11
  %33 = load i64, ptr %9, align 8, !tbaa !11
  %34 = load ptr, ptr %7, align 8, !tbaa !5
  %35 = getelementptr inbounds i64, ptr %34, i32 1
  store ptr %35, ptr %7, align 8, !tbaa !5
  store volatile i64 %33, ptr %34, align 8, !tbaa !11
  %36 = load i64, ptr %10, align 8, !tbaa !11
  %37 = load ptr, ptr %7, align 8, !tbaa !5
  %38 = getelementptr inbounds i64, ptr %37, i32 1
  store ptr %38, ptr %7, align 8, !tbaa !5
  store volatile i64 %36, ptr %37, align 8, !tbaa !11
  %39 = load i64, ptr %11, align 8, !tbaa !11
  %40 = load ptr, ptr %7, align 8, !tbaa !5
  %41 = getelementptr inbounds i64, ptr %40, i32 1
  store ptr %41, ptr %7, align 8, !tbaa !5
  store volatile i64 %39, ptr %40, align 8, !tbaa !11
  %42 = load ptr, ptr %5, align 8, !tbaa !5
  %43 = getelementptr inbounds i64, ptr %42, i32 1
  store ptr %43, ptr %5, align 8, !tbaa !5
  %44 = load i64, ptr %42, align 8, !tbaa !11
  store i64 %44, ptr %8, align 8, !tbaa !11
  %45 = load ptr, ptr %5, align 8, !tbaa !5
  %46 = getelementptr inbounds i64, ptr %45, i32 1
  store ptr %46, ptr %5, align 8, !tbaa !5
  %47 = load i64, ptr %45, align 8, !tbaa !11
  store i64 %47, ptr %9, align 8, !tbaa !11
  %48 = load ptr, ptr %5, align 8, !tbaa !5
  %49 = getelementptr inbounds i64, ptr %48, i32 1
  store ptr %49, ptr %5, align 8, !tbaa !5
  %50 = load i64, ptr %48, align 8, !tbaa !11
  store i64 %50, ptr %10, align 8, !tbaa !11
  %51 = load ptr, ptr %5, align 8, !tbaa !5
  %52 = getelementptr inbounds i64, ptr %51, i32 1
  store ptr %52, ptr %5, align 8, !tbaa !5
  %53 = load i64, ptr %51, align 8, !tbaa !11
  store i64 %53, ptr %11, align 8, !tbaa !11
  %54 = load i64, ptr %8, align 8, !tbaa !11
  %55 = load ptr, ptr %7, align 8, !tbaa !5
  %56 = getelementptr inbounds i64, ptr %55, i32 1
  store ptr %56, ptr %7, align 8, !tbaa !5
  store volatile i64 %54, ptr %55, align 8, !tbaa !11
  %57 = load i64, ptr %9, align 8, !tbaa !11
  %58 = load ptr, ptr %7, align 8, !tbaa !5
  %59 = getelementptr inbounds i64, ptr %58, i32 1
  store ptr %59, ptr %7, align 8, !tbaa !5
  store volatile i64 %57, ptr %58, align 8, !tbaa !11
  %60 = load i64, ptr %10, align 8, !tbaa !11
  %61 = load ptr, ptr %7, align 8, !tbaa !5
  %62 = getelementptr inbounds i64, ptr %61, i32 1
  store ptr %62, ptr %7, align 8, !tbaa !5
  store volatile i64 %60, ptr %61, align 8, !tbaa !11
  %63 = load i64, ptr %11, align 8, !tbaa !11
  %64 = load ptr, ptr %7, align 8, !tbaa !5
  %65 = getelementptr inbounds i64, ptr %64, i32 1
  store ptr %65, ptr %7, align 8, !tbaa !5
  store volatile i64 %63, ptr %64, align 8, !tbaa !11
  br label %13, !llvm.loop !13

66:                                               ; preds = %13
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #2
  ret void
}

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

; 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 = { 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 = !{!12, !12, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"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: nofree norecurse nounwind uwtable
define dso_local void @aligned_block_copy(ptr noalias noundef %0, ptr noalias nocapture noundef readonly %1, i32 noundef %2) local_unnamed_addr #0 {
  %4 = icmp sgt i32 %2, 63
  br i1 %4, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %3, %.lr.ph
  %.030 = phi ptr [ %24, %.lr.ph ], [ %1, %3 ]
  %.02529 = phi i32 [ %5, %.lr.ph ], [ %2, %3 ]
  %.02628 = phi ptr [ %29, %.lr.ph ], [ %0, %3 ]
  %5 = add nsw i32 %.02529, -64
  %6 = getelementptr inbounds i8, ptr %.030, i64 8
  %7 = load i64, ptr %.030, align 8, !tbaa !5
  %8 = getelementptr inbounds i8, ptr %.030, i64 16
  %9 = load i64, ptr %6, align 8, !tbaa !5
  %10 = getelementptr inbounds i8, ptr %.030, i64 24
  %11 = load i64, ptr %8, align 8, !tbaa !5
  %12 = getelementptr inbounds i8, ptr %.030, i64 32
  %13 = load i64, ptr %10, align 8, !tbaa !5
  %14 = getelementptr inbounds i8, ptr %.02628, i64 8
  store volatile i64 %7, ptr %.02628, align 8, !tbaa !5
  %15 = getelementptr inbounds i8, ptr %.02628, i64 16
  store volatile i64 %9, ptr %14, align 8, !tbaa !5
  %16 = getelementptr inbounds i8, ptr %.02628, i64 24
  store volatile i64 %11, ptr %15, align 8, !tbaa !5
  %17 = getelementptr inbounds i8, ptr %.02628, i64 32
  store volatile i64 %13, ptr %16, align 8, !tbaa !5
  %18 = getelementptr inbounds i8, ptr %.030, i64 40
  %19 = load i64, ptr %12, align 8, !tbaa !5
  %20 = getelementptr inbounds i8, ptr %.030, i64 48
  %21 = load i64, ptr %18, align 8, !tbaa !5
  %22 = getelementptr inbounds i8, ptr %.030, i64 56
  %23 = load i64, ptr %20, align 8, !tbaa !5
  %24 = getelementptr inbounds i8, ptr %.030, i64 64
  %25 = load i64, ptr %22, align 8, !tbaa !5
  %26 = getelementptr inbounds i8, ptr %.02628, i64 40
  store volatile i64 %19, ptr %17, align 8, !tbaa !5
  %27 = getelementptr inbounds i8, ptr %.02628, i64 48
  store volatile i64 %21, ptr %26, align 8, !tbaa !5
  %28 = getelementptr inbounds i8, ptr %.02628, i64 56
  store volatile i64 %23, ptr %27, align 8, !tbaa !5
  %29 = getelementptr inbounds i8, ptr %.02628, i64 64
  store volatile i64 %25, ptr %28, align 8, !tbaa !5
  %30 = icmp ugt i32 %.02529, 127
  br i1 %30, label %.lr.ph, label %._crit_edge, !llvm.loop !9

._crit_edge:                                      ; preds = %.lr.ph, %3
  ret void
}

attributes #0 = { nofree norecurse 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 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}


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