; LLVM IR from apache/kvrocks :: src/vendor/crc64.ll (Z18crcspeed16big_initPFttPKvmEPA256_t)

; 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 uwtable
declare dso_local void @_Z21crcspeed16little_initPFttPKvmEPA256_t(ptr noundef, ptr noundef) #1

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden noundef i64 @_ZL4rev8m(i64 noundef) #2

; Function Attrs: mustprogress uwtable
define dso_local void @_Z18crcspeed16big_initPFttPKvmEPA256_t(ptr noundef %0, ptr noundef %1) #1 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %8 = load ptr, ptr %3, align 8, !tbaa !5
  %9 = load ptr, ptr %4, align 8, !tbaa !5
  call void @_Z21crcspeed16little_initPFttPKvmEPA256_t(ptr noundef %8, ptr noundef %9)
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #3
  store i32 0, ptr %5, align 4, !tbaa !9
  br label %10

10:                                               ; preds = %42, %2
  %11 = load i32, ptr %5, align 4, !tbaa !9
  %12 = icmp slt i32 %11, 8
  br i1 %12, label %14, label %13

13:                                               ; preds = %10
  store i32 2, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #3
  br label %45

14:                                               ; preds = %10
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #3
  store i32 0, ptr %7, align 4, !tbaa !9
  br label %15

15:                                               ; preds = %38, %14
  %16 = load i32, ptr %7, align 4, !tbaa !9
  %17 = icmp slt i32 %16, 256
  br i1 %17, label %19, label %18

18:                                               ; preds = %15
  store i32 5, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #3
  br label %41

19:                                               ; preds = %15
  %20 = load ptr, ptr %4, align 8, !tbaa !5
  %21 = load i32, ptr %5, align 4, !tbaa !9
  %22 = sext i32 %21 to i64
  %23 = getelementptr inbounds [256 x i16], ptr %20, i64 %22
  %24 = load i32, ptr %7, align 4, !tbaa !9
  %25 = sext i32 %24 to i64
  %26 = getelementptr inbounds [256 x i16], ptr %23, i64 0, i64 %25
  %27 = load i16, ptr %26, align 2, !tbaa !11
  %28 = zext i16 %27 to i64
  %29 = call noundef i64 @_ZL4rev8m(i64 noundef %28)
  %30 = trunc i64 %29 to i16
  %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 [256 x i16], ptr %31, i64 %33
  %35 = load i32, ptr %7, align 4, !tbaa !9
  %36 = sext i32 %35 to i64
  %37 = getelementptr inbounds [256 x i16], ptr %34, i64 0, i64 %36
  store i16 %30, ptr %37, align 2, !tbaa !11
  br label %38

38:                                               ; preds = %19
  %39 = load i32, ptr %7, align 4, !tbaa !9
  %40 = add nsw i32 %39, 1
  store i32 %40, ptr %7, align 4, !tbaa !9
  br label %15, !llvm.loop !13

41:                                               ; preds = %18
  br label %42

42:                                               ; preds = %41
  %43 = load i32, ptr %5, align 4, !tbaa !9
  %44 = add nsw i32 %43, 1
  store i32 %44, ptr %5, align 4, !tbaa !9
  br label %10, !llvm.loop !15

45:                                               ; preds = %13
  ret void
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress 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 = { inlinehint 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 #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++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"short", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}


; 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 uwtable
declare dso_local void @_Z21crcspeed16little_initPFttPKvmEPA256_t(ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden noundef i64 @_ZL4rev8m(i64 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
define dso_local void @_Z18crcspeed16big_initPFttPKvmEPA256_t(ptr noundef %0, ptr noundef %1) local_unnamed_addr #0 {
.preheader:
  tail call void @_Z21crcspeed16little_initPFttPKvmEPA256_t(ptr noundef %0, ptr noundef %1)
  br label %38

.preheader.1:                                     ; preds = %38, %.preheader.1
  %indvars.iv.1 = phi i64 [ %indvars.iv.next.1, %.preheader.1 ], [ 0, %38 ]
  %2 = getelementptr inbounds [256 x i16], ptr %1, i64 1, i64 %indvars.iv.1
  %3 = load i16, ptr %2, align 2, !tbaa !5
  %4 = zext i16 %3 to i64
  %5 = tail call noundef i64 @_ZL4rev8m(i64 noundef %4)
  %6 = trunc i64 %5 to i16
  store i16 %6, ptr %2, align 2, !tbaa !5
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv.1, 1
  %exitcond.1.not = icmp eq i64 %indvars.iv.next.1, 256
  br i1 %exitcond.1.not, label %.preheader.2, label %.preheader.1, !llvm.loop !9

.preheader.2:                                     ; preds = %.preheader.1, %.preheader.2
  %indvars.iv.2 = phi i64 [ %indvars.iv.next.2, %.preheader.2 ], [ 0, %.preheader.1 ]
  %7 = getelementptr inbounds [256 x i16], ptr %1, i64 2, i64 %indvars.iv.2
  %8 = load i16, ptr %7, align 2, !tbaa !5
  %9 = zext i16 %8 to i64
  %10 = tail call noundef i64 @_ZL4rev8m(i64 noundef %9)
  %11 = trunc i64 %10 to i16
  store i16 %11, ptr %7, align 2, !tbaa !5
  %indvars.iv.next.2 = add nuw nsw i64 %indvars.iv.2, 1
  %exitcond.2.not = icmp eq i64 %indvars.iv.next.2, 256
  br i1 %exitcond.2.not, label %.preheader.3, label %.preheader.2, !llvm.loop !9

.preheader.3:                                     ; preds = %.preheader.2, %.preheader.3
  %indvars.iv.3 = phi i64 [ %indvars.iv.next.3, %.preheader.3 ], [ 0, %.preheader.2 ]
  %12 = getelementptr inbounds [256 x i16], ptr %1, i64 3, i64 %indvars.iv.3
  %13 = load i16, ptr %12, align 2, !tbaa !5
  %14 = zext i16 %13 to i64
  %15 = tail call noundef i64 @_ZL4rev8m(i64 noundef %14)
  %16 = trunc i64 %15 to i16
  store i16 %16, ptr %12, align 2, !tbaa !5
  %indvars.iv.next.3 = add nuw nsw i64 %indvars.iv.3, 1
  %exitcond.3.not = icmp eq i64 %indvars.iv.next.3, 256
  br i1 %exitcond.3.not, label %.preheader.4, label %.preheader.3, !llvm.loop !9

.preheader.4:                                     ; preds = %.preheader.3, %.preheader.4
  %indvars.iv.4 = phi i64 [ %indvars.iv.next.4, %.preheader.4 ], [ 0, %.preheader.3 ]
  %17 = getelementptr inbounds [256 x i16], ptr %1, i64 4, i64 %indvars.iv.4
  %18 = load i16, ptr %17, align 2, !tbaa !5
  %19 = zext i16 %18 to i64
  %20 = tail call noundef i64 @_ZL4rev8m(i64 noundef %19)
  %21 = trunc i64 %20 to i16
  store i16 %21, ptr %17, align 2, !tbaa !5
  %indvars.iv.next.4 = add nuw nsw i64 %indvars.iv.4, 1
  %exitcond.4.not = icmp eq i64 %indvars.iv.next.4, 256
  br i1 %exitcond.4.not, label %.preheader.5, label %.preheader.4, !llvm.loop !9

.preheader.5:                                     ; preds = %.preheader.4, %.preheader.5
  %indvars.iv.5 = phi i64 [ %indvars.iv.next.5, %.preheader.5 ], [ 0, %.preheader.4 ]
  %22 = getelementptr inbounds [256 x i16], ptr %1, i64 5, i64 %indvars.iv.5
  %23 = load i16, ptr %22, align 2, !tbaa !5
  %24 = zext i16 %23 to i64
  %25 = tail call noundef i64 @_ZL4rev8m(i64 noundef %24)
  %26 = trunc i64 %25 to i16
  store i16 %26, ptr %22, align 2, !tbaa !5
  %indvars.iv.next.5 = add nuw nsw i64 %indvars.iv.5, 1
  %exitcond.5.not = icmp eq i64 %indvars.iv.next.5, 256
  br i1 %exitcond.5.not, label %.preheader.6, label %.preheader.5, !llvm.loop !9

.preheader.6:                                     ; preds = %.preheader.5, %.preheader.6
  %indvars.iv.6 = phi i64 [ %indvars.iv.next.6, %.preheader.6 ], [ 0, %.preheader.5 ]
  %27 = getelementptr inbounds [256 x i16], ptr %1, i64 6, i64 %indvars.iv.6
  %28 = load i16, ptr %27, align 2, !tbaa !5
  %29 = zext i16 %28 to i64
  %30 = tail call noundef i64 @_ZL4rev8m(i64 noundef %29)
  %31 = trunc i64 %30 to i16
  store i16 %31, ptr %27, align 2, !tbaa !5
  %indvars.iv.next.6 = add nuw nsw i64 %indvars.iv.6, 1
  %exitcond.6.not = icmp eq i64 %indvars.iv.next.6, 256
  br i1 %exitcond.6.not, label %.preheader.7, label %.preheader.6, !llvm.loop !9

.preheader.7:                                     ; preds = %.preheader.6, %.preheader.7
  %indvars.iv.7 = phi i64 [ %indvars.iv.next.7, %.preheader.7 ], [ 0, %.preheader.6 ]
  %32 = getelementptr inbounds [256 x i16], ptr %1, i64 7, i64 %indvars.iv.7
  %33 = load i16, ptr %32, align 2, !tbaa !5
  %34 = zext i16 %33 to i64
  %35 = tail call noundef i64 @_ZL4rev8m(i64 noundef %34)
  %36 = trunc i64 %35 to i16
  store i16 %36, ptr %32, align 2, !tbaa !5
  %indvars.iv.next.7 = add nuw nsw i64 %indvars.iv.7, 1
  %exitcond.7.not = icmp eq i64 %indvars.iv.next.7, 256
  br i1 %exitcond.7.not, label %37, label %.preheader.7, !llvm.loop !9

37:                                               ; preds = %.preheader.7
  ret void

38:                                               ; preds = %.preheader, %38
  %indvars.iv = phi i64 [ 0, %.preheader ], [ %indvars.iv.next, %38 ]
  %39 = getelementptr inbounds [256 x i16], ptr %1, i64 0, i64 %indvars.iv
  %40 = load i16, ptr %39, align 2, !tbaa !5
  %41 = zext i16 %40 to i64
  %42 = tail call noundef i64 @_ZL4rev8m(i64 noundef %41)
  %43 = trunc i64 %42 to i16
  store i16 %43, ptr %39, align 2, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, 256
  br i1 %exitcond.not, label %.preheader.1, label %38, !llvm.loop !9
}

attributes #0 = { mustprogress 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 = { inlinehint 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" }

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


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass