; LLVM IR from intel/qpl :: tools/utils/generators/configurators/rfc1951_stream/break_header_configurators/_5127b499 (generator37FirstDistanceLengthCode16Configurator8generateEv)

; 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"

%"class.qpl::test::random" = type { %"class.qpl::test::random_base" }
%"class.qpl::test::random_base" = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, double, double, double, double }

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN12gz_generator37FirstDistanceLengthCode16Configurator8generateEv(ptr noundef nonnull align 8 dereferenceable(384) %0) unnamed_addr #0 align 2 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca %"class.qpl::test::random", align 8
  %5 = alloca i8, align 1
  %6 = alloca i8, align 1
  store ptr %0, ptr %2, align 8, !tbaa !5
  %7 = load ptr, ptr %2, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #6
  store ptr null, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 72, ptr %4) #6
  %8 = call noundef i32 @_ZNK12gz_generator16TestConfigurator10get_m_seedEv(ptr noundef nonnull align 8 dereferenceable(384) %7)
  call void @_ZN3qpl4test6randomC2Eddj(ptr noundef nonnull align 8 dereferenceable(72) %4, double noundef 4.000000e+00, double noundef 7.000000e+00, i32 noundef %8)
  call void @llvm.lifetime.start.p0(i64 1, ptr %5) #6
  %9 = call noundef zeroext i8 @_ZN3qpl4test11random_basecvhEv(ptr noundef nonnull align 8 dereferenceable(72) %4)
  store i8 %9, ptr %5, align 1, !tbaa !9
  %10 = call noalias noundef nonnull ptr @_Znam(i64 noundef 120) #7
  store ptr %10, ptr %3, align 8, !tbaa !5
  %11 = load ptr, ptr %3, align 8, !tbaa !5
  %12 = call noundef i32 @_ZNK12gz_generator16TestConfigurator26makeRandomLengthCodesTableEPjjh(ptr noundef nonnull align 8 dereferenceable(384) %7, ptr noundef %11, i32 noundef 30, i8 noundef zeroext 15)
  call void @llvm.lifetime.start.p0(i64 1, ptr %6) #6
  store i8 1, ptr %6, align 1, !tbaa !9
  br label %13

13:                                               ; preds = %28, %1
  %14 = load i8, ptr %6, align 1, !tbaa !9
  %15 = zext i8 %14 to i32
  %16 = load i8, ptr %5, align 1, !tbaa !9
  %17 = zext i8 %16 to i32
  %18 = icmp slt i32 %15, %17
  br i1 %18, label %20, label %19

19:                                               ; preds = %13
  call void @llvm.lifetime.end.p0(i64 1, ptr %6) #6
  br label %31

20:                                               ; preds = %13
  %21 = load ptr, ptr %3, align 8, !tbaa !5
  %22 = getelementptr inbounds i32, ptr %21, i64 0
  %23 = load i32, ptr %22, align 4, !tbaa !10
  %24 = load ptr, ptr %3, align 8, !tbaa !5
  %25 = load i8, ptr %6, align 1, !tbaa !9
  %26 = zext i8 %25 to i64
  %27 = getelementptr inbounds i32, ptr %24, i64 %26
  store i32 %23, ptr %27, align 4, !tbaa !10
  br label %28

28:                                               ; preds = %20
  %29 = load i8, ptr %6, align 1, !tbaa !9
  %30 = add i8 %29, 1
  store i8 %30, ptr %6, align 1, !tbaa !9
  br label %13, !llvm.loop !12

31:                                               ; preds = %19
  call void @_ZN12gz_generator16TestConfigurator19declareDynamicBlockEv(ptr noundef nonnull align 8 dereferenceable(384) %7)
  %32 = load ptr, ptr %3, align 8, !tbaa !5
  call void @_ZN12gz_generator16TestConfigurator18declareVectorTokenENS0_15VectorTokenTypeEPKjj(ptr noundef nonnull align 8 dereferenceable(384) %7, i8 noundef zeroext 2, ptr noundef %32, i32 noundef 30)
  %33 = load ptr, ptr %3, align 8, !tbaa !5
  call void @_ZN12gz_generator16TestConfigurator18declareVectorTokenENS0_15VectorTokenTypeEPKjj(ptr noundef nonnull align 8 dereferenceable(384) %7, i8 noundef zeroext 3, ptr noundef %33, i32 noundef 30)
  call void @_ZN12gz_generator16TestConfigurator16declareTestTokenEjj(ptr noundef nonnull align 8 dereferenceable(384) %7, i32 noundef 4, i32 noundef 1)
  call void @_ZN12gz_generator16TestConfigurator23writeRandomHuffmanBlockEj(ptr noundef nonnull align 8 dereferenceable(384) %7, i32 noundef 0)
  call void @_ZN12gz_generator16TestConfigurator18declareFinishBlockEv(ptr noundef nonnull align 8 dereferenceable(384) %7)
  %34 = load ptr, ptr %3, align 8, !tbaa !5
  %35 = icmp eq ptr %34, null
  br i1 %35, label %37, label %36

36:                                               ; preds = %31
  call void @_ZdaPv(ptr noundef %34) #8
  br label %37

37:                                               ; preds = %36, %31
  call void @llvm.lifetime.end.p0(i64 1, ptr %5) #6
  call void @llvm.lifetime.end.p0(i64 72, ptr %4) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #6
  ret i32 0
}

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK12gz_generator16TestConfigurator10get_m_seedEv(ptr noundef nonnull align 8 dereferenceable(384)) #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3qpl4test6randomC2Eddj(ptr noundef nonnull align 8 dereferenceable(72), double noundef, double noundef, i32 noundef) unnamed_addr #0 align 2

declare noundef zeroext i8 @_ZN3qpl4test11random_basecvhEv(ptr noundef nonnull align 8 dereferenceable(72)) #3

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znam(i64 noundef) #4

declare noundef i32 @_ZNK12gz_generator16TestConfigurator26makeRandomLengthCodesTableEPjjh(ptr noundef nonnull align 8 dereferenceable(384), ptr noundef, i32 noundef, i8 noundef zeroext) #3

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

declare void @_ZN12gz_generator16TestConfigurator19declareDynamicBlockEv(ptr noundef nonnull align 8 dereferenceable(384)) #3

declare void @_ZN12gz_generator16TestConfigurator18declareVectorTokenENS0_15VectorTokenTypeEPKjj(ptr noundef nonnull align 8 dereferenceable(384), i8 noundef zeroext, ptr noundef, i32 noundef) #3

declare void @_ZN12gz_generator16TestConfigurator16declareTestTokenEjj(ptr noundef nonnull align 8 dereferenceable(384), i32 noundef, i32 noundef) #3

declare void @_ZN12gz_generator16TestConfigurator23writeRandomHuffmanBlockEj(ptr noundef nonnull align 8 dereferenceable(384), i32 noundef) #3

declare void @_ZN12gz_generator16TestConfigurator18declareFinishBlockEv(ptr noundef nonnull align 8 dereferenceable(384)) #3

; Function Attrs: nobuiltin nounwind
declare void @_ZdaPv(ptr noundef) #5

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 = { "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 #4 = { nobuiltin allocsize(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 #5 = { nobuiltin nounwind "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 #6 = { nounwind }
attributes #7 = { builtin allocsize(0) }
attributes #8 = { builtin 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 = !{!7, !7, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"int", !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"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"

%"class.qpl::test::random" = type { %"class.qpl::test::random_base" }
%"class.qpl::test::random_base" = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, double, double, double, double }

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN12gz_generator37FirstDistanceLengthCode16Configurator8generateEv(ptr noundef nonnull align 8 dereferenceable(384) %0) unnamed_addr #0 align 2 {
  %2 = alloca %"class.qpl::test::random", align 8
  call void @llvm.lifetime.start.p0(i64 72, ptr nonnull %2) #6
  %3 = tail call noundef i32 @_ZNK12gz_generator16TestConfigurator10get_m_seedEv(ptr noundef nonnull align 8 dereferenceable(384) %0)
  call void @_ZN3qpl4test6randomC2Eddj(ptr noundef nonnull align 8 dereferenceable(72) %2, double noundef 4.000000e+00, double noundef 7.000000e+00, i32 noundef %3)
  %4 = call noundef zeroext i8 @_ZN3qpl4test11random_basecvhEv(ptr noundef nonnull align 8 dereferenceable(72) %2)
  %5 = call noalias noundef nonnull dereferenceable(120) ptr @_Znam(i64 noundef 120) #7
  %6 = call noundef i32 @_ZNK12gz_generator16TestConfigurator26makeRandomLengthCodesTableEPjjh(ptr noundef nonnull align 8 dereferenceable(384) %0, ptr noundef nonnull %5, i32 noundef 30, i8 noundef zeroext 15)
  %7 = icmp ugt i8 %4, 1
  br i1 %7, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %1
  %8 = load i32, ptr %5, align 4, !tbaa !5
  %wide.trip.count = zext i8 %4 to i64
  %9 = add nsw i64 %wide.trip.count, -1
  %min.iters.check = icmp ult i8 %4, 9
  br i1 %min.iters.check, label %scalar.ph.preheader, label %vector.ph

scalar.ph.preheader:                              ; preds = %middle.block, %.lr.ph
  %indvars.iv.ph = phi i64 [ 1, %.lr.ph ], [ %ind.end, %middle.block ]
  br label %scalar.ph

vector.ph:                                        ; preds = %.lr.ph
  %n.vec = and i64 %9, -8
  %ind.end = or disjoint i64 %n.vec, 1
  %broadcast.splatinsert = insertelement <4 x i32> poison, i32 %8, i64 0
  %broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %offset.idx = or disjoint i64 %index, 1
  %10 = getelementptr inbounds i32, ptr %5, i64 %offset.idx
  %11 = getelementptr inbounds i8, ptr %10, i64 16
  store <4 x i32> %broadcast.splat, ptr %10, align 4, !tbaa !5
  store <4 x i32> %broadcast.splat, ptr %11, align 4, !tbaa !5
  %index.next = add nuw i64 %index, 8
  %12 = icmp eq i64 %index.next, %n.vec
  br i1 %12, label %middle.block, label %vector.body, !llvm.loop !9

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %9, %n.vec
  br i1 %cmp.n, label %._crit_edge, label %scalar.ph.preheader

._crit_edge:                                      ; preds = %scalar.ph, %middle.block, %1
  call void @_ZN12gz_generator16TestConfigurator19declareDynamicBlockEv(ptr noundef nonnull align 8 dereferenceable(384) %0)
  call void @_ZN12gz_generator16TestConfigurator18declareVectorTokenENS0_15VectorTokenTypeEPKjj(ptr noundef nonnull align 8 dereferenceable(384) %0, i8 noundef zeroext 2, ptr noundef nonnull %5, i32 noundef 30)
  call void @_ZN12gz_generator16TestConfigurator18declareVectorTokenENS0_15VectorTokenTypeEPKjj(ptr noundef nonnull align 8 dereferenceable(384) %0, i8 noundef zeroext 3, ptr noundef nonnull %5, i32 noundef 30)
  call void @_ZN12gz_generator16TestConfigurator16declareTestTokenEjj(ptr noundef nonnull align 8 dereferenceable(384) %0, i32 noundef 4, i32 noundef 1)
  call void @_ZN12gz_generator16TestConfigurator23writeRandomHuffmanBlockEj(ptr noundef nonnull align 8 dereferenceable(384) %0, i32 noundef 0)
  call void @_ZN12gz_generator16TestConfigurator18declareFinishBlockEv(ptr noundef nonnull align 8 dereferenceable(384) %0)
  call void @_ZdaPv(ptr noundef nonnull %5) #8
  call void @llvm.lifetime.end.p0(i64 72, ptr nonnull %2) #6
  ret i32 0

scalar.ph:                                        ; preds = %scalar.ph.preheader, %scalar.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %scalar.ph ], [ %indvars.iv.ph, %scalar.ph.preheader ]
  %13 = getelementptr inbounds i32, ptr %5, i64 %indvars.iv
  store i32 %8, ptr %13, align 4, !tbaa !5
  %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 %scalar.ph, !llvm.loop !13
}

; 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 nounwind uwtable
declare dso_local noundef i32 @_ZNK12gz_generator16TestConfigurator10get_m_seedEv(ptr noundef nonnull align 8 dereferenceable(384)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3qpl4test6randomC2Eddj(ptr noundef nonnull align 8 dereferenceable(72), double noundef, double noundef, i32 noundef) unnamed_addr #0 align 2

declare noundef zeroext i8 @_ZN3qpl4test11random_basecvhEv(ptr noundef nonnull align 8 dereferenceable(72)) local_unnamed_addr #3

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znam(i64 noundef) local_unnamed_addr #4

declare noundef i32 @_ZNK12gz_generator16TestConfigurator26makeRandomLengthCodesTableEPjjh(ptr noundef nonnull align 8 dereferenceable(384), ptr noundef, i32 noundef, i8 noundef zeroext) local_unnamed_addr #3

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

declare void @_ZN12gz_generator16TestConfigurator19declareDynamicBlockEv(ptr noundef nonnull align 8 dereferenceable(384)) local_unnamed_addr #3

declare void @_ZN12gz_generator16TestConfigurator18declareVectorTokenENS0_15VectorTokenTypeEPKjj(ptr noundef nonnull align 8 dereferenceable(384), i8 noundef zeroext, ptr noundef, i32 noundef) local_unnamed_addr #3

declare void @_ZN12gz_generator16TestConfigurator16declareTestTokenEjj(ptr noundef nonnull align 8 dereferenceable(384), i32 noundef, i32 noundef) local_unnamed_addr #3

declare void @_ZN12gz_generator16TestConfigurator23writeRandomHuffmanBlockEj(ptr noundef nonnull align 8 dereferenceable(384), i32 noundef) local_unnamed_addr #3

declare void @_ZN12gz_generator16TestConfigurator18declareFinishBlockEv(ptr noundef nonnull align 8 dereferenceable(384)) local_unnamed_addr #3

; Function Attrs: nobuiltin nounwind
declare void @_ZdaPv(ptr noundef) local_unnamed_addr #5

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 = { "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 #4 = { nobuiltin allocsize(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 #5 = { nobuiltin nounwind "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 #6 = { nounwind }
attributes #7 = { builtin allocsize(0) }
attributes #8 = { builtin 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !10, !12, !11}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopLoadEliminationPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,LoopVectorizePass,SROAPass,SimplifyCFGPass,TailCallElimPass