; LLVM IR from intel/qpl :: tools/utils/generators/configurators (configurator)

; 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 }
%"class.gz_generator::TestConfigurator" = type { %"class.gz_generator::ITestConfigurator", %"class.std::unique_ptr", i32, %"class.qpl::test::random", %"class.qpl::test::random", %"class.qpl::test::random", %"class.qpl::test::random", %"class.qpl::test::random" }
%"class.gz_generator::ITestConfigurator" = type { ptr }
%"class.std::unique_ptr" = type { %"struct.std::__uniq_ptr_data" }
%"struct.std::__uniq_ptr_data" = type { %"class.std::__uniq_ptr_impl" }
%"class.std::__uniq_ptr_impl" = type { %"class.std::tuple" }
%"class.std::tuple" = type { %"struct.std::_Tuple_impl" }
%"struct.std::_Tuple_impl" = type { %"struct.std::_Head_base.1" }
%"struct.std::_Head_base.1" = type { ptr }

declare noundef float @_ZN3qpl4test11random_basecvfEv(ptr noundef nonnull align 8 dereferenceable(72)) #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 uwtable
define dso_local noundef i32 @_ZN12gz_generator16TestConfigurator28writeRandomReferenceSequenceEjjj(ptr noundef nonnull align 8 dereferenceable(384) %0, i32 noundef %1, i32 noundef %2, i32 noundef %3) #2 align 2 {
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca %"class.qpl::test::random", align 8
  %15 = alloca %"class.qpl::test::random", align 8
  store ptr %0, ptr %5, align 8, !tbaa !5
  store i32 %1, ptr %6, align 4, !tbaa !9
  store i32 %2, ptr %7, align 4, !tbaa !9
  store i32 %3, ptr %8, align 4, !tbaa !9
  %16 = load ptr, ptr %5, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #3
  %17 = load i32, ptr %7, align 4, !tbaa !9
  store i32 %17, ptr %9, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #3
  store i32 0, ptr %10, align 4, !tbaa !9
  br label %18

18:                                               ; preds = %84, %4
  %19 = load i32, ptr %10, align 4, !tbaa !9
  %20 = load i32, ptr %6, align 4, !tbaa !9
  %21 = icmp ult i32 %19, %20
  br i1 %21, label %22, label %26

22:                                               ; preds = %18
  %23 = load i32, ptr %8, align 4, !tbaa !9
  %24 = load i32, ptr %9, align 4, !tbaa !9
  %25 = icmp ugt i32 %23, %24
  br label %26

26:                                               ; preds = %22, %18
  %27 = phi i1 [ false, %18 ], [ %25, %22 ]
  br i1 %27, label %29, label %28

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

29:                                               ; preds = %26
  %30 = getelementptr inbounds %"class.gz_generator::TestConfigurator", ptr %16, i32 0, i32 3
  %31 = call noundef float @_ZN3qpl4test11random_basecvfEv(ptr noundef nonnull align 8 dereferenceable(72) %30)
  %32 = fcmp olt float %31, 0x3FE6666660000000
  br i1 %32, label %41, label %33

33:                                               ; preds = %29
  %34 = load i32, ptr %9, align 4, !tbaa !9
  %35 = icmp ult i32 %34, 3
  br i1 %35, label %41, label %36

36:                                               ; preds = %33
  %37 = load i32, ptr %8, align 4, !tbaa !9
  %38 = load i32, ptr %9, align 4, !tbaa !9
  %39 = sub i32 %37, %38
  %40 = icmp ult i32 %39, 3
  br i1 %40, label %41, label %46

41:                                               ; preds = %36, %33, %29
  %42 = getelementptr inbounds %"class.gz_generator::TestConfigurator", ptr %16, i32 0, i32 5
  %43 = call noundef i32 @_ZN3qpl4test11random_basecvjEv(ptr noundef nonnull align 8 dereferenceable(72) %42)
  call void @_ZN12gz_generator16TestConfigurator14declareLiteralEj(ptr noundef nonnull align 8 dereferenceable(384) %16, i32 noundef %43)
  %44 = load i32, ptr %9, align 4, !tbaa !9
  %45 = add i32 %44, 1
  store i32 %45, ptr %9, align 4, !tbaa !9
  br label %83

46:                                               ; preds = %36
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #3
  store i32 0, ptr %11, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #3
  store i32 0, ptr %12, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #3
  %47 = load i32, ptr %8, align 4, !tbaa !9
  %48 = load i32, ptr %9, align 4, !tbaa !9
  %49 = sub i32 %47, %48
  %50 = icmp ult i32 %49, 258
  br i1 %50, label %51, label %55

51:                                               ; preds = %46
  %52 = load i32, ptr %8, align 4, !tbaa !9
  %53 = load i32, ptr %9, align 4, !tbaa !9
  %54 = sub i32 %52, %53
  br label %56

55:                                               ; preds = %46
  br label %56

56:                                               ; preds = %55, %51
  %57 = phi i32 [ %54, %51 ], [ 258, %55 ]
  store i32 %57, ptr %13, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 72, ptr %14) #3
  %58 = load i32, ptr %9, align 4, !tbaa !9
  %59 = icmp ult i32 %58, 4096
  br i1 %59, label %60, label %62

60:                                               ; preds = %56
  %61 = load i32, ptr %9, align 4, !tbaa !9
  br label %63

62:                                               ; preds = %56
  br label %63

63:                                               ; preds = %62, %60
  %64 = phi i32 [ %61, %60 ], [ 4096, %62 ]
  %65 = uitofp i32 %64 to double
  call void @_ZN12gz_generator16TestConfigurator27update_range_m_randomOffsetEdd(ptr dead_on_unwind writable sret(%"class.qpl::test::random") align 8 %14, ptr noundef nonnull align 8 dereferenceable(384) %16, double noundef 1.000000e+00, double noundef %65)
  %66 = call noundef i32 @_ZN3qpl4test11random_basecvjEv(ptr noundef nonnull align 8 dereferenceable(72) %14)
  store i32 %66, ptr %11, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 72, ptr %14) #3
  call void @llvm.lifetime.start.p0(i64 72, ptr %15) #3
  %67 = load i32, ptr %9, align 4, !tbaa !9
  %68 = load i32, ptr %13, align 4, !tbaa !9
  %69 = icmp ult i32 %67, %68
  br i1 %69, label %70, label %72

70:                                               ; preds = %63
  %71 = load i32, ptr %9, align 4, !tbaa !9
  br label %74

72:                                               ; preds = %63
  %73 = load i32, ptr %13, align 4, !tbaa !9
  br label %74

74:                                               ; preds = %72, %70
  %75 = phi i32 [ %71, %70 ], [ %73, %72 ]
  %76 = uitofp i32 %75 to double
  call void @_ZN12gz_generator16TestConfigurator26update_range_m_randomMatchEdd(ptr dead_on_unwind writable sret(%"class.qpl::test::random") align 8 %15, ptr noundef nonnull align 8 dereferenceable(384) %16, double noundef 3.000000e+00, double noundef %76)
  %77 = call noundef i32 @_ZN3qpl4test11random_basecvjEv(ptr noundef nonnull align 8 dereferenceable(72) %15)
  store i32 %77, ptr %12, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 72, ptr %15) #3
  %78 = load i32, ptr %12, align 4, !tbaa !9
  %79 = load i32, ptr %11, align 4, !tbaa !9
  call void @_ZN12gz_generator16TestConfigurator16declareReferenceEjj(ptr noundef nonnull align 8 dereferenceable(384) %16, i32 noundef %78, i32 noundef %79)
  %80 = load i32, ptr %12, align 4, !tbaa !9
  %81 = load i32, ptr %9, align 4, !tbaa !9
  %82 = add i32 %81, %80
  store i32 %82, ptr %9, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #3
  br label %83

83:                                               ; preds = %74, %41
  br label %84

84:                                               ; preds = %83
  %85 = load i32, ptr %10, align 4, !tbaa !9
  %86 = add i32 %85, 1
  store i32 %86, ptr %10, align 4, !tbaa !9
  br label %18, !llvm.loop !11

87:                                               ; preds = %28
  %88 = load i32, ptr %9, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #3
  ret i32 %88
}

declare noundef i32 @_ZN3qpl4test11random_basecvjEv(ptr noundef nonnull align 8 dereferenceable(72)) #0

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN12gz_generator16TestConfigurator27update_range_m_randomOffsetEdd(ptr dead_on_unwind noalias writable sret(%"class.qpl::test::random") align 8, ptr noundef nonnull align 8 dereferenceable(384), double noundef, double noundef) #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN12gz_generator16TestConfigurator26update_range_m_randomMatchEdd(ptr dead_on_unwind noalias writable sret(%"class.qpl::test::random") align 8, ptr noundef nonnull align 8 dereferenceable(384), double noundef, double noundef) #2 align 2

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

attributes #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 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 = distinct !{!11, !12}
!12 = !{!"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 }

declare noundef float @_ZN3qpl4test11random_basecvfEv(ptr noundef nonnull align 8 dereferenceable(72)) local_unnamed_addr #0

; 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
define dso_local noundef i32 @_ZN12gz_generator16TestConfigurator28writeRandomReferenceSequenceEjjj(ptr noundef nonnull align 8 dereferenceable(384) %0, i32 noundef %1, i32 noundef %2, i32 noundef %3) local_unnamed_addr #2 align 2 {
  %5 = alloca %"class.qpl::test::random", align 8
  %6 = alloca %"class.qpl::test::random", align 8
  %7 = icmp ne i32 %1, 0
  %8 = icmp ult i32 %2, %3
  %9 = and i1 %7, %8
  br i1 %9, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %4
  %10 = getelementptr inbounds i8, ptr %0, i64 24
  %11 = getelementptr inbounds i8, ptr %0, i64 168
  br label %12

._crit_edge:                                      ; preds = %31, %4
  %.0.lcssa = phi i32 [ %2, %4 ], [ %.1, %31 ]
  ret i32 %.0.lcssa

12:                                               ; preds = %.lr.ph, %31
  %.030 = phi i32 [ %2, %.lr.ph ], [ %.1, %31 ]
  %.02629 = phi i32 [ 0, %.lr.ph ], [ %32, %31 ]
  %13 = call noundef float @_ZN3qpl4test11random_basecvfEv(ptr noundef nonnull align 8 dereferenceable(72) %10)
  %14 = fcmp olt float %13, 0x3FE6666660000000
  %15 = icmp ult i32 %.030, 3
  %or.cond = select i1 %14, i1 true, i1 %15
  br i1 %or.cond, label %19, label %16

16:                                               ; preds = %12
  %17 = sub i32 %3, %.030
  %18 = icmp ult i32 %17, 3
  br i1 %18, label %19, label %22

19:                                               ; preds = %16, %12
  %20 = call noundef i32 @_ZN3qpl4test11random_basecvjEv(ptr noundef nonnull align 8 dereferenceable(72) %11)
  call void @_ZN12gz_generator16TestConfigurator14declareLiteralEj(ptr noundef nonnull align 8 dereferenceable(384) %0, i32 noundef %20)
  %21 = add nuw i32 %.030, 1
  br label %31

22:                                               ; preds = %16
  call void @llvm.lifetime.start.p0(i64 72, ptr nonnull %5) #4
  %23 = call i32 @llvm.umin.i32(i32 %.030, i32 4096)
  %24 = uitofp nneg i32 %23 to double
  call void @_ZN12gz_generator16TestConfigurator27update_range_m_randomOffsetEdd(ptr dead_on_unwind nonnull writable sret(%"class.qpl::test::random") align 8 %5, ptr noundef nonnull align 8 dereferenceable(384) %0, double noundef 1.000000e+00, double noundef %24)
  %25 = call noundef i32 @_ZN3qpl4test11random_basecvjEv(ptr noundef nonnull align 8 dereferenceable(72) %5)
  call void @llvm.lifetime.end.p0(i64 72, ptr nonnull %5) #4
  call void @llvm.lifetime.start.p0(i64 72, ptr nonnull %6) #4
  %26 = call i32 @llvm.umin.i32(i32 %17, i32 %.030)
  %27 = call i32 @llvm.umin.i32(i32 %26, i32 258)
  %28 = uitofp nneg i32 %27 to double
  call void @_ZN12gz_generator16TestConfigurator26update_range_m_randomMatchEdd(ptr dead_on_unwind nonnull writable sret(%"class.qpl::test::random") align 8 %6, ptr noundef nonnull align 8 dereferenceable(384) %0, double noundef 3.000000e+00, double noundef %28)
  %29 = call noundef i32 @_ZN3qpl4test11random_basecvjEv(ptr noundef nonnull align 8 dereferenceable(72) %6)
  call void @llvm.lifetime.end.p0(i64 72, ptr nonnull %6) #4
  call void @_ZN12gz_generator16TestConfigurator16declareReferenceEjj(ptr noundef nonnull align 8 dereferenceable(384) %0, i32 noundef %29, i32 noundef %25)
  %30 = add i32 %29, %.030
  br label %31

31:                                               ; preds = %19, %22
  %.1 = phi i32 [ %21, %19 ], [ %30, %22 ]
  %32 = add nuw i32 %.02629, 1
  %33 = icmp ult i32 %32, %1
  %34 = icmp ult i32 %.1, %3
  %35 = select i1 %33, i1 %34, i1 false
  br i1 %35, label %12, label %._crit_edge, !llvm.loop !5
}

declare noundef i32 @_ZN3qpl4test11random_basecvjEv(ptr noundef nonnull align 8 dereferenceable(72)) local_unnamed_addr #0

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN12gz_generator16TestConfigurator27update_range_m_randomOffsetEdd(ptr dead_on_unwind noalias writable sret(%"class.qpl::test::random") align 8, ptr noundef nonnull align 8 dereferenceable(384), double noundef, double noundef) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN12gz_generator16TestConfigurator26update_range_m_randomMatchEdd(ptr dead_on_unwind noalias writable sret(%"class.qpl::test::random") align 8, ptr noundef nonnull align 8 dereferenceable(384), double noundef, double noundef) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN12gz_generator16TestConfigurator16declareReferenceEjj(ptr noundef nonnull align 8 dereferenceable(384), i32 noundef, i32 noundef) local_unnamed_addr #2 align 2

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.umin.i32(i32, i32) #3

attributes #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 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { 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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}


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