; LLVM IR from intel/qpl :: tools/utils/generators/random_generator.ll (ZN3qpl4test11random_base4initEj)

; 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_base" = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, double, double, double, double }

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef double @_ZN3qpl4test11random_basecvdEv(ptr noundef nonnull align 8 dereferenceable(72)) #1 align 2

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

19:                                               ; preds = %25, %2
  %20 = load i32, ptr %5, align 4, !tbaa !9
  %21 = icmp slt i32 %20, 10
  br i1 %21, label %23, label %22

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

23:                                               ; preds = %19
  %24 = call noundef double @_ZN3qpl4test11random_basecvdEv(ptr noundef nonnull align 8 dereferenceable(72) %6)
  br label %25

25:                                               ; preds = %23
  %26 = load i32, ptr %5, align 4, !tbaa !9
  %27 = add nsw i32 %26, 1
  store i32 %27, ptr %5, align 4, !tbaa !9
  br label %19, !llvm.loop !21

28:                                               ; preds = %22
  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 = { 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, !10, i64 0}
!12 = !{!"_ZTSN3qpl4test11random_baseE", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !10, i64 24, !10, i64 28, !10, i64 32, !13, i64 40, !13, i64 48, !13, i64 56, !13, i64 64}
!13 = !{!"double", !7, i64 0}
!14 = !{!12, !10, i64 12}
!15 = !{!12, !10, i64 4}
!16 = !{!12, !10, i64 16}
!17 = !{!12, !10, i64 8}
!18 = !{!12, !10, i64 20}
!19 = !{!12, !10, i64 24}
!20 = !{!12, !10, i64 28}
!21 = distinct !{!21, !22}
!22 = !{!"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
declare dso_local noundef double @_ZN3qpl4test11random_basecvdEv(ptr noundef nonnull align 8 dereferenceable(72)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3qpl4test11random_base4initEj(ptr noundef nonnull align 8 dereferenceable(72) %0, i32 noundef %1) local_unnamed_addr #0 align 2 {
  %3 = getelementptr inbounds i8, ptr %0, i64 12
  %4 = load <2 x i32>, ptr %0, align 8, !tbaa !5
  store <2 x i32> %4, ptr %3, align 4, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %0, i64 8
  %6 = load i32, ptr %5, align 8, !tbaa !9
  %7 = getelementptr inbounds i8, ptr %0, i64 20
  store i32 %6, ptr %7, align 4, !tbaa !12
  %8 = getelementptr inbounds i8, ptr %0, i64 24
  store i32 1, ptr %8, align 8, !tbaa !13
  %9 = getelementptr inbounds i8, ptr %0, i64 28
  store i32 %1, ptr %9, align 4, !tbaa !14
  %10 = tail call noundef double @_ZN3qpl4test11random_basecvdEv(ptr noundef nonnull align 8 dereferenceable(72) %0)
  %11 = tail call noundef double @_ZN3qpl4test11random_basecvdEv(ptr noundef nonnull align 8 dereferenceable(72) %0)
  %12 = tail call noundef double @_ZN3qpl4test11random_basecvdEv(ptr noundef nonnull align 8 dereferenceable(72) %0)
  %13 = tail call noundef double @_ZN3qpl4test11random_basecvdEv(ptr noundef nonnull align 8 dereferenceable(72) %0)
  %14 = tail call noundef double @_ZN3qpl4test11random_basecvdEv(ptr noundef nonnull align 8 dereferenceable(72) %0)
  %15 = tail call noundef double @_ZN3qpl4test11random_basecvdEv(ptr noundef nonnull align 8 dereferenceable(72) %0)
  %16 = tail call noundef double @_ZN3qpl4test11random_basecvdEv(ptr noundef nonnull align 8 dereferenceable(72) %0)
  %17 = tail call noundef double @_ZN3qpl4test11random_basecvdEv(ptr noundef nonnull align 8 dereferenceable(72) %0)
  %18 = tail call noundef double @_ZN3qpl4test11random_basecvdEv(ptr noundef nonnull align 8 dereferenceable(72) %0)
  %19 = tail call noundef double @_ZN3qpl4test11random_basecvdEv(ptr noundef nonnull align 8 dereferenceable(72) %0)
  ret void
}

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

!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, !6, i64 8}
!10 = !{!"_ZTSN3qpl4test11random_baseE", !6, i64 0, !6, i64 4, !6, i64 8, !6, i64 12, !6, i64 16, !6, i64 20, !6, i64 24, !6, i64 28, !6, i64 32, !11, i64 40, !11, i64 48, !11, i64 56, !11, i64 64}
!11 = !{!"double", !7, i64 0}
!12 = !{!10, !6, i64 20}
!13 = !{!10, !6, i64 24}
!14 = !{!10, !6, i64 28}


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