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

; 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: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @llvm.prefetch.p0(ptr nocapture readonly, i32 immarg, i32 immarg, i32 immarg) #1

; Function Attrs: nounwind uwtable
define dso_local void @aligned_block_copy_pf64(ptr noalias noundef %0, ptr noalias noundef %1, i32 noundef %2) #2 {
  %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) #3
  %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) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #3
  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 %68

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

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite, inaccessiblemem: readwrite) }
attributes #2 = { 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 = !{!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: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @llvm.prefetch.p0(ptr nocapture readonly, i32 immarg, i32 immarg, i32 immarg) #0

; Function Attrs: nofree norecurse nounwind uwtable
define dso_local void @aligned_block_copy_pf64(ptr noalias noundef %0, ptr noalias nocapture noundef readonly %1, i32 noundef %2) local_unnamed_addr #1 {
  %4 = icmp sgt i32 %2, 63
  br i1 %4, label %.lr.ph, label %._crit_edge

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

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite, inaccessiblemem: readwrite) }
attributes #1 = { 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,TailCallElimPass