; LLVM IR from fast-pack/FastPFOR :: src/bitpacking.ll/Z14 (fastunpack64PKjPm)

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

6:                                                ; preds = %37, %2
  %7 = load i32, ptr %5, align 4, !tbaa !9
  %8 = icmp slt i32 %7, 32
  br i1 %8, label %10, label %9

9:                                                ; preds = %6
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #2
  br label %40

10:                                               ; preds = %6
  %11 = load ptr, ptr %3, align 8, !tbaa !5
  %12 = load i32, ptr %5, align 4, !tbaa !9
  %13 = mul nsw i32 %12, 2
  %14 = sext i32 %13 to i64
  %15 = getelementptr inbounds i32, ptr %11, i64 %14
  %16 = load i32, ptr %15, align 4, !tbaa !9
  %17 = zext i32 %16 to i64
  %18 = load ptr, ptr %4, align 8, !tbaa !5
  %19 = load i32, ptr %5, align 4, !tbaa !9
  %20 = sext i32 %19 to i64
  %21 = getelementptr inbounds i64, ptr %18, i64 %20
  store i64 %17, ptr %21, align 8, !tbaa !11
  %22 = load ptr, ptr %3, align 8, !tbaa !5
  %23 = load i32, ptr %5, align 4, !tbaa !9
  %24 = mul nsw i32 %23, 2
  %25 = add nsw i32 %24, 1
  %26 = sext i32 %25 to i64
  %27 = getelementptr inbounds i32, ptr %22, i64 %26
  %28 = load i32, ptr %27, align 4, !tbaa !9
  %29 = zext i32 %28 to i64
  %30 = shl i64 %29, 32
  %31 = load ptr, ptr %4, align 8, !tbaa !5
  %32 = load i32, ptr %5, align 4, !tbaa !9
  %33 = sext i32 %32 to i64
  %34 = getelementptr inbounds i64, ptr %31, i64 %33
  %35 = load i64, ptr %34, align 8, !tbaa !11
  %36 = or i64 %35, %30
  store i64 %36, ptr %34, align 8, !tbaa !11
  br label %37

37:                                               ; preds = %10
  %38 = load i32, ptr %5, align 4, !tbaa !9
  %39 = add nsw i32 %38, 1
  store i32 %39, ptr %5, align 4, !tbaa !9
  br label %6, !llvm.loop !13

40:                                               ; preds = %9
  ret void
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress 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 #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++ 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 nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable
define dso_local void @_Z14__fastunpack64PKjPm(ptr noalias nocapture noundef readonly %0, ptr noalias nocapture noundef writeonly %1) local_unnamed_addr #0 {
vector.ph:
  %2 = getelementptr inbounds i8, ptr %0, i64 16
  %wide.vec = load <4 x i32>, ptr %0, align 4, !tbaa !5
  %wide.vec11 = load <4 x i32>, ptr %2, align 4, !tbaa !5
  %strided.vec = shufflevector <4 x i32> %wide.vec, <4 x i32> poison, <2 x i32> <i32 0, i32 2>
  %strided.vec12 = shufflevector <4 x i32> %wide.vec11, <4 x i32> poison, <2 x i32> <i32 0, i32 2>
  %strided.vec13 = shufflevector <4 x i32> %wide.vec, <4 x i32> poison, <2 x i32> <i32 1, i32 3>
  %strided.vec14 = shufflevector <4 x i32> %wide.vec11, <4 x i32> poison, <2 x i32> <i32 1, i32 3>
  %3 = zext <2 x i32> %strided.vec to <2 x i64>
  %4 = zext <2 x i32> %strided.vec12 to <2 x i64>
  %5 = zext <2 x i32> %strided.vec13 to <2 x i64>
  %6 = zext <2 x i32> %strided.vec14 to <2 x i64>
  %7 = shl nuw <2 x i64> %5, <i64 32, i64 32>
  %8 = shl nuw <2 x i64> %6, <i64 32, i64 32>
  %9 = or disjoint <2 x i64> %7, %3
  %10 = or disjoint <2 x i64> %8, %4
  %11 = getelementptr inbounds i8, ptr %1, i64 16
  store <2 x i64> %9, ptr %1, align 8, !tbaa !9
  store <2 x i64> %10, ptr %11, align 8, !tbaa !9
  %12 = getelementptr inbounds i8, ptr %0, i64 32
  %13 = getelementptr inbounds i8, ptr %0, i64 48
  %wide.vec.1 = load <4 x i32>, ptr %12, align 4, !tbaa !5
  %wide.vec11.1 = load <4 x i32>, ptr %13, align 4, !tbaa !5
  %strided.vec.1 = shufflevector <4 x i32> %wide.vec.1, <4 x i32> poison, <2 x i32> <i32 0, i32 2>
  %strided.vec12.1 = shufflevector <4 x i32> %wide.vec11.1, <4 x i32> poison, <2 x i32> <i32 0, i32 2>
  %strided.vec13.1 = shufflevector <4 x i32> %wide.vec.1, <4 x i32> poison, <2 x i32> <i32 1, i32 3>
  %strided.vec14.1 = shufflevector <4 x i32> %wide.vec11.1, <4 x i32> poison, <2 x i32> <i32 1, i32 3>
  %14 = zext <2 x i32> %strided.vec.1 to <2 x i64>
  %15 = zext <2 x i32> %strided.vec12.1 to <2 x i64>
  %16 = getelementptr inbounds i8, ptr %1, i64 32
  %17 = zext <2 x i32> %strided.vec13.1 to <2 x i64>
  %18 = zext <2 x i32> %strided.vec14.1 to <2 x i64>
  %19 = shl nuw <2 x i64> %17, <i64 32, i64 32>
  %20 = shl nuw <2 x i64> %18, <i64 32, i64 32>
  %21 = or disjoint <2 x i64> %19, %14
  %22 = or disjoint <2 x i64> %20, %15
  %23 = getelementptr inbounds i8, ptr %1, i64 48
  store <2 x i64> %21, ptr %16, align 8, !tbaa !9
  store <2 x i64> %22, ptr %23, align 8, !tbaa !9
  %24 = getelementptr inbounds i8, ptr %0, i64 64
  %25 = getelementptr inbounds i8, ptr %0, i64 80
  %wide.vec.2 = load <4 x i32>, ptr %24, align 4, !tbaa !5
  %wide.vec11.2 = load <4 x i32>, ptr %25, align 4, !tbaa !5
  %strided.vec.2 = shufflevector <4 x i32> %wide.vec.2, <4 x i32> poison, <2 x i32> <i32 0, i32 2>
  %strided.vec12.2 = shufflevector <4 x i32> %wide.vec11.2, <4 x i32> poison, <2 x i32> <i32 0, i32 2>
  %strided.vec13.2 = shufflevector <4 x i32> %wide.vec.2, <4 x i32> poison, <2 x i32> <i32 1, i32 3>
  %strided.vec14.2 = shufflevector <4 x i32> %wide.vec11.2, <4 x i32> poison, <2 x i32> <i32 1, i32 3>
  %26 = zext <2 x i32> %strided.vec.2 to <2 x i64>
  %27 = zext <2 x i32> %strided.vec12.2 to <2 x i64>
  %28 = getelementptr inbounds i8, ptr %1, i64 64
  %29 = zext <2 x i32> %strided.vec13.2 to <2 x i64>
  %30 = zext <2 x i32> %strided.vec14.2 to <2 x i64>
  %31 = shl nuw <2 x i64> %29, <i64 32, i64 32>
  %32 = shl nuw <2 x i64> %30, <i64 32, i64 32>
  %33 = or disjoint <2 x i64> %31, %26
  %34 = or disjoint <2 x i64> %32, %27
  %35 = getelementptr inbounds i8, ptr %1, i64 80
  store <2 x i64> %33, ptr %28, align 8, !tbaa !9
  store <2 x i64> %34, ptr %35, align 8, !tbaa !9
  %36 = getelementptr inbounds i8, ptr %0, i64 96
  %37 = getelementptr inbounds i8, ptr %0, i64 112
  %wide.vec.3 = load <4 x i32>, ptr %36, align 4, !tbaa !5
  %wide.vec11.3 = load <4 x i32>, ptr %37, align 4, !tbaa !5
  %strided.vec.3 = shufflevector <4 x i32> %wide.vec.3, <4 x i32> poison, <2 x i32> <i32 0, i32 2>
  %strided.vec12.3 = shufflevector <4 x i32> %wide.vec11.3, <4 x i32> poison, <2 x i32> <i32 0, i32 2>
  %strided.vec13.3 = shufflevector <4 x i32> %wide.vec.3, <4 x i32> poison, <2 x i32> <i32 1, i32 3>
  %strided.vec14.3 = shufflevector <4 x i32> %wide.vec11.3, <4 x i32> poison, <2 x i32> <i32 1, i32 3>
  %38 = zext <2 x i32> %strided.vec.3 to <2 x i64>
  %39 = zext <2 x i32> %strided.vec12.3 to <2 x i64>
  %40 = getelementptr inbounds i8, ptr %1, i64 96
  %41 = zext <2 x i32> %strided.vec13.3 to <2 x i64>
  %42 = zext <2 x i32> %strided.vec14.3 to <2 x i64>
  %43 = shl nuw <2 x i64> %41, <i64 32, i64 32>
  %44 = shl nuw <2 x i64> %42, <i64 32, i64 32>
  %45 = or disjoint <2 x i64> %43, %38
  %46 = or disjoint <2 x i64> %44, %39
  %47 = getelementptr inbounds i8, ptr %1, i64 112
  store <2 x i64> %45, ptr %40, align 8, !tbaa !9
  store <2 x i64> %46, ptr %47, align 8, !tbaa !9
  %48 = getelementptr inbounds i8, ptr %0, i64 128
  %49 = getelementptr inbounds i8, ptr %0, i64 144
  %wide.vec.4 = load <4 x i32>, ptr %48, align 4, !tbaa !5
  %wide.vec11.4 = load <4 x i32>, ptr %49, align 4, !tbaa !5
  %strided.vec.4 = shufflevector <4 x i32> %wide.vec.4, <4 x i32> poison, <2 x i32> <i32 0, i32 2>
  %strided.vec12.4 = shufflevector <4 x i32> %wide.vec11.4, <4 x i32> poison, <2 x i32> <i32 0, i32 2>
  %strided.vec13.4 = shufflevector <4 x i32> %wide.vec.4, <4 x i32> poison, <2 x i32> <i32 1, i32 3>
  %strided.vec14.4 = shufflevector <4 x i32> %wide.vec11.4, <4 x i32> poison, <2 x i32> <i32 1, i32 3>
  %50 = zext <2 x i32> %strided.vec.4 to <2 x i64>
  %51 = zext <2 x i32> %strided.vec12.4 to <2 x i64>
  %52 = getelementptr inbounds i8, ptr %1, i64 128
  %53 = zext <2 x i32> %strided.vec13.4 to <2 x i64>
  %54 = zext <2 x i32> %strided.vec14.4 to <2 x i64>
  %55 = shl nuw <2 x i64> %53, <i64 32, i64 32>
  %56 = shl nuw <2 x i64> %54, <i64 32, i64 32>
  %57 = or disjoint <2 x i64> %55, %50
  %58 = or disjoint <2 x i64> %56, %51
  %59 = getelementptr inbounds i8, ptr %1, i64 144
  store <2 x i64> %57, ptr %52, align 8, !tbaa !9
  store <2 x i64> %58, ptr %59, align 8, !tbaa !9
  %60 = getelementptr inbounds i8, ptr %0, i64 160
  %61 = getelementptr inbounds i8, ptr %0, i64 176
  %wide.vec.5 = load <4 x i32>, ptr %60, align 4, !tbaa !5
  %wide.vec11.5 = load <4 x i32>, ptr %61, align 4, !tbaa !5
  %strided.vec.5 = shufflevector <4 x i32> %wide.vec.5, <4 x i32> poison, <2 x i32> <i32 0, i32 2>
  %strided.vec12.5 = shufflevector <4 x i32> %wide.vec11.5, <4 x i32> poison, <2 x i32> <i32 0, i32 2>
  %strided.vec13.5 = shufflevector <4 x i32> %wide.vec.5, <4 x i32> poison, <2 x i32> <i32 1, i32 3>
  %strided.vec14.5 = shufflevector <4 x i32> %wide.vec11.5, <4 x i32> poison, <2 x i32> <i32 1, i32 3>
  %62 = zext <2 x i32> %strided.vec.5 to <2 x i64>
  %63 = zext <2 x i32> %strided.vec12.5 to <2 x i64>
  %64 = getelementptr inbounds i8, ptr %1, i64 160
  %65 = zext <2 x i32> %strided.vec13.5 to <2 x i64>
  %66 = zext <2 x i32> %strided.vec14.5 to <2 x i64>
  %67 = shl nuw <2 x i64> %65, <i64 32, i64 32>
  %68 = shl nuw <2 x i64> %66, <i64 32, i64 32>
  %69 = or disjoint <2 x i64> %67, %62
  %70 = or disjoint <2 x i64> %68, %63
  %71 = getelementptr inbounds i8, ptr %1, i64 176
  store <2 x i64> %69, ptr %64, align 8, !tbaa !9
  store <2 x i64> %70, ptr %71, align 8, !tbaa !9
  %72 = getelementptr inbounds i8, ptr %0, i64 192
  %73 = getelementptr inbounds i8, ptr %0, i64 208
  %wide.vec.6 = load <4 x i32>, ptr %72, align 4, !tbaa !5
  %wide.vec11.6 = load <4 x i32>, ptr %73, align 4, !tbaa !5
  %strided.vec.6 = shufflevector <4 x i32> %wide.vec.6, <4 x i32> poison, <2 x i32> <i32 0, i32 2>
  %strided.vec12.6 = shufflevector <4 x i32> %wide.vec11.6, <4 x i32> poison, <2 x i32> <i32 0, i32 2>
  %strided.vec13.6 = shufflevector <4 x i32> %wide.vec.6, <4 x i32> poison, <2 x i32> <i32 1, i32 3>
  %strided.vec14.6 = shufflevector <4 x i32> %wide.vec11.6, <4 x i32> poison, <2 x i32> <i32 1, i32 3>
  %74 = zext <2 x i32> %strided.vec.6 to <2 x i64>
  %75 = zext <2 x i32> %strided.vec12.6 to <2 x i64>
  %76 = getelementptr inbounds i8, ptr %1, i64 192
  %77 = zext <2 x i32> %strided.vec13.6 to <2 x i64>
  %78 = zext <2 x i32> %strided.vec14.6 to <2 x i64>
  %79 = shl nuw <2 x i64> %77, <i64 32, i64 32>
  %80 = shl nuw <2 x i64> %78, <i64 32, i64 32>
  %81 = or disjoint <2 x i64> %79, %74
  %82 = or disjoint <2 x i64> %80, %75
  %83 = getelementptr inbounds i8, ptr %1, i64 208
  store <2 x i64> %81, ptr %76, align 8, !tbaa !9
  store <2 x i64> %82, ptr %83, align 8, !tbaa !9
  %84 = getelementptr inbounds i8, ptr %0, i64 224
  %85 = getelementptr inbounds i8, ptr %0, i64 240
  %wide.vec.7 = load <4 x i32>, ptr %84, align 4, !tbaa !5
  %wide.vec11.7 = load <4 x i32>, ptr %85, align 4, !tbaa !5
  %strided.vec.7 = shufflevector <4 x i32> %wide.vec.7, <4 x i32> poison, <2 x i32> <i32 0, i32 2>
  %strided.vec12.7 = shufflevector <4 x i32> %wide.vec11.7, <4 x i32> poison, <2 x i32> <i32 0, i32 2>
  %strided.vec13.7 = shufflevector <4 x i32> %wide.vec.7, <4 x i32> poison, <2 x i32> <i32 1, i32 3>
  %strided.vec14.7 = shufflevector <4 x i32> %wide.vec11.7, <4 x i32> poison, <2 x i32> <i32 1, i32 3>
  %86 = zext <2 x i32> %strided.vec.7 to <2 x i64>
  %87 = zext <2 x i32> %strided.vec12.7 to <2 x i64>
  %88 = getelementptr inbounds i8, ptr %1, i64 224
  %89 = zext <2 x i32> %strided.vec13.7 to <2 x i64>
  %90 = zext <2 x i32> %strided.vec14.7 to <2 x i64>
  %91 = shl nuw <2 x i64> %89, <i64 32, i64 32>
  %92 = shl nuw <2 x i64> %90, <i64 32, i64 32>
  %93 = or disjoint <2 x i64> %91, %86
  %94 = or disjoint <2 x i64> %92, %87
  %95 = getelementptr inbounds i8, ptr %1, i64 240
  store <2 x i64> %93, ptr %88, align 8, !tbaa !9
  store <2 x i64> %94, ptr %95, align 8, !tbaa !9
  ret void
}

attributes #0 = { mustprogress nofree norecurse nosync nounwind memory(argmem: readwrite) 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++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long", !7, i64 0}


; Effective O3 passes: DSEPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,LoopLoadEliminationPass,LoopRotatePass,LoopUnrollPass,LoopVectorizePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass