; LLVM IR from intel/qpl :: sources/middle-layer/other/crc.ll (ZN3qpl2ml5other11perform_crcEPKhjmbb)

; 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: mustprogress uwtable
define dso_local noundef i64 @_ZN3qpl2ml5other11perform_crcEPKhjmbb(ptr noundef %0, i32 noundef %1, i64 noundef %2, i1 noundef zeroext %3, i1 noundef zeroext %4) #0 {
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i64, align 8
  %9 = alloca i8, align 1
  %10 = alloca i8, align 1
  %11 = alloca [256 x i64], align 16
  %12 = alloca i64, align 8
  %13 = alloca i32, align 4
  store ptr %0, ptr %6, align 8, !tbaa !5
  store i32 %1, ptr %7, align 4, !tbaa !9
  store i64 %2, ptr %8, align 8, !tbaa !11
  %14 = zext i1 %3 to i8
  store i8 %14, ptr %9, align 1, !tbaa !13
  %15 = zext i1 %4 to i8
  store i8 %15, ptr %10, align 1, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 2048, ptr %11) #3
  %16 = getelementptr inbounds [256 x i64], ptr %11, i64 0, i64 0
  %17 = load i64, ptr %8, align 8, !tbaa !11
  %18 = load i8, ptr %9, align 1, !tbaa !13, !range !15, !noundef !16
  %19 = trunc i8 %18 to i1
  call void @_ZN3qpl2ml5otherL16crc64_init_tableEPmmb(ptr noundef %16, i64 noundef %17, i1 noundef zeroext %19)
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #3
  %20 = load i64, ptr %8, align 8, !tbaa !11
  %21 = load i8, ptr %9, align 1, !tbaa !13, !range !15, !noundef !16
  %22 = trunc i8 %21 to i1
  %23 = load i8, ptr %10, align 1, !tbaa !13, !range !15, !noundef !16
  %24 = trunc i8 %23 to i1
  %25 = call noundef i64 @_ZN3qpl2ml5otherL14crc64_init_crcEmbb(i64 noundef %20, i1 noundef zeroext %22, i1 noundef zeroext %24)
  store i64 %25, ptr %12, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #3
  store i32 0, ptr %13, align 4, !tbaa !9
  br label %26

26:                                               ; preds = %42, %5
  %27 = load i32, ptr %13, align 4, !tbaa !9
  %28 = load i32, ptr %7, align 4, !tbaa !9
  %29 = icmp ult i32 %27, %28
  br i1 %29, label %31, label %30

30:                                               ; preds = %26
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #3
  br label %45

31:                                               ; preds = %26
  %32 = load ptr, ptr %6, align 8, !tbaa !5
  %33 = load i32, ptr %13, align 4, !tbaa !9
  %34 = zext i32 %33 to i64
  %35 = getelementptr inbounds i8, ptr %32, i64 %34
  %36 = load i8, ptr %35, align 1, !tbaa !17
  %37 = getelementptr inbounds [256 x i64], ptr %11, i64 0, i64 0
  %38 = load i64, ptr %12, align 8, !tbaa !11
  %39 = load i8, ptr %9, align 1, !tbaa !13, !range !15, !noundef !16
  %40 = trunc i8 %39 to i1
  %41 = call noundef i64 @_ZN3qpl2ml5otherL12crc64_updateEhPKmmb(i8 noundef zeroext %36, ptr noundef %37, i64 noundef %38, i1 noundef zeroext %40)
  store i64 %41, ptr %12, align 8, !tbaa !11
  br label %42

42:                                               ; preds = %31
  %43 = load i32, ptr %13, align 4, !tbaa !9
  %44 = add i32 %43, 1
  store i32 %44, ptr %13, align 4, !tbaa !9
  br label %26, !llvm.loop !18

45:                                               ; preds = %30
  %46 = load i64, ptr %12, align 8, !tbaa !11
  %47 = load i64, ptr %8, align 8, !tbaa !11
  %48 = load i8, ptr %9, align 1, !tbaa !13, !range !15, !noundef !16
  %49 = trunc i8 %48 to i1
  %50 = load i8, ptr %10, align 1, !tbaa !13, !range !15, !noundef !16
  %51 = trunc i8 %50 to i1
  %52 = call noundef i64 @_ZN3qpl2ml5otherL14crc64_finalizeEmmbb(i64 noundef %46, i64 noundef %47, i1 noundef zeroext %49, i1 noundef zeroext %51)
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 2048, ptr %11) #3
  ret i64 %52
}

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

; Function Attrs: mustprogress uwtable
declare hidden void @_ZN3qpl2ml5otherL16crc64_init_tableEPmmb(ptr noundef, i64 noundef, i1 noundef zeroext) #0

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef i64 @_ZN3qpl2ml5otherL14crc64_init_crcEmbb(i64 noundef, i1 noundef zeroext, i1 noundef zeroext) #2

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef i64 @_ZN3qpl2ml5otherL12crc64_updateEhPKmmb(i8 noundef zeroext, ptr noundef, i64 noundef, i1 noundef zeroext) #2

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

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef i64 @_ZN3qpl2ml5otherL14crc64_finalizeEmmbb(i64 noundef, i64 noundef, i1 noundef zeroext, i1 noundef zeroext) #2

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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 = !{!"long", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"bool", !7, i64 0}
!15 = !{i8 0, i8 2}
!16 = !{}
!17 = !{!7, !7, i64 0}
!18 = distinct !{!18, !19}
!19 = !{!"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 uwtable
define dso_local noundef i64 @_ZN3qpl2ml5other11perform_crcEPKhjmbb(ptr nocapture noundef readonly %0, i32 noundef %1, i64 noundef %2, i1 noundef zeroext %3, i1 noundef zeroext %4) local_unnamed_addr #0 {
  %6 = alloca [256 x i64], align 16
  call void @llvm.lifetime.start.p0(i64 2048, ptr nonnull %6) #3
  call void @_ZN3qpl2ml5otherL16crc64_init_tableEPmmb(ptr noundef nonnull %6, i64 noundef %2, i1 noundef zeroext %3)
  %7 = call noundef i64 @_ZN3qpl2ml5otherL14crc64_init_crcEmbb(i64 noundef %2, i1 noundef zeroext %3, i1 noundef zeroext %4)
  %.not = icmp eq i32 %1, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %5
  %wide.trip.count = zext i32 %1 to i64
  br label %.lr.ph

._crit_edge:                                      ; preds = %.lr.ph, %5
  %.015.lcssa = phi i64 [ %7, %5 ], [ %11, %.lr.ph ]
  %8 = call noundef i64 @_ZN3qpl2ml5otherL14crc64_finalizeEmmbb(i64 noundef %.015.lcssa, i64 noundef %2, i1 noundef zeroext %3, i1 noundef zeroext %4)
  call void @llvm.lifetime.end.p0(i64 2048, ptr nonnull %6) #3
  ret i64 %8

.lr.ph:                                           ; preds = %.lr.ph.preheader, %.lr.ph
  %indvars.iv = phi i64 [ 0, %.lr.ph.preheader ], [ %indvars.iv.next, %.lr.ph ]
  %.01516 = phi i64 [ %7, %.lr.ph.preheader ], [ %11, %.lr.ph ]
  %9 = getelementptr inbounds i8, ptr %0, i64 %indvars.iv
  %10 = load i8, ptr %9, align 1, !tbaa !5
  %11 = call noundef i64 @_ZN3qpl2ml5otherL12crc64_updateEhPKmmb(i8 noundef zeroext %10, ptr noundef nonnull %6, i64 noundef %.01516, i1 noundef zeroext %3)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph, !llvm.loop !8
}

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

; Function Attrs: mustprogress uwtable
declare hidden void @_ZN3qpl2ml5otherL16crc64_init_tableEPmmb(ptr noundef, i64 noundef, i1 noundef zeroext) local_unnamed_addr #0

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef i64 @_ZN3qpl2ml5otherL14crc64_init_crcEmbb(i64 noundef, i1 noundef zeroext, i1 noundef zeroext) local_unnamed_addr #2

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef i64 @_ZN3qpl2ml5otherL12crc64_updateEhPKmmb(i8 noundef zeroext, ptr noundef, i64 noundef, i1 noundef zeroext) local_unnamed_addr #2

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

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef i64 @_ZN3qpl2ml5otherL14crc64_finalizeEmmbb(i64 noundef, i64 noundef, i1 noundef zeroext, i1 noundef zeroext) local_unnamed_addr #2

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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass