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

; 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: mustprogress uwtable
define dso_local void @_ZN3qpl4test11random_baseC2Eddj(ptr noundef nonnull align 8 dereferenceable(72) %0, double noundef %1, double noundef %2, i32 noundef %3) unnamed_addr #0 align 2 {
  %5 = alloca ptr, align 8
  %6 = alloca double, align 8
  %7 = alloca double, align 8
  %8 = alloca i32, align 4
  %9 = alloca double, align 8
  %10 = alloca double, align 8
  %11 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store double %1, ptr %6, align 8, !tbaa !9
  store double %2, ptr %7, align 8, !tbaa !9
  store i32 %3, ptr %8, align 4, !tbaa !11
  %12 = load ptr, ptr %5, align 8
  %13 = getelementptr inbounds %"class.qpl::test::random_base", ptr %12, i32 0, i32 3
  store i32 41, ptr %13, align 4, !tbaa !13
  %14 = getelementptr inbounds %"class.qpl::test::random_base", ptr %12, i32 0, i32 4
  store i32 18467, ptr %14, align 8, !tbaa !15
  %15 = getelementptr inbounds %"class.qpl::test::random_base", ptr %12, i32 0, i32 5
  store i32 6334, ptr %15, align 4, !tbaa !16
  %16 = getelementptr inbounds %"class.qpl::test::random_base", ptr %12, i32 0, i32 6
  store i32 1, ptr %16, align 8, !tbaa !17
  %17 = getelementptr inbounds %"class.qpl::test::random_base", ptr %12, i32 0, i32 7
  %18 = load i32, ptr %8, align 4, !tbaa !11
  store i32 %18, ptr %17, align 4, !tbaa !18
  %19 = getelementptr inbounds %"class.qpl::test::random_base", ptr %12, i32 0, i32 8
  %20 = load i32, ptr %8, align 4, !tbaa !11
  store i32 %20, ptr %19, align 8, !tbaa !19
  %21 = getelementptr inbounds %"class.qpl::test::random_base", ptr %12, i32 0, i32 9
  %22 = load double, ptr %7, align 8, !tbaa !9
  store double %22, ptr %21, align 8, !tbaa !20
  %23 = getelementptr inbounds %"class.qpl::test::random_base", ptr %12, i32 0, i32 10
  %24 = load double, ptr %6, align 8, !tbaa !9
  store double %24, ptr %23, align 8, !tbaa !21
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #3
  %25 = getelementptr inbounds %"class.qpl::test::random_base", ptr %12, i32 0, i32 10
  %26 = load double, ptr %25, align 8, !tbaa !21
  %27 = fneg double %26
  %28 = getelementptr inbounds %"class.qpl::test::random_base", ptr %12, i32 0, i32 9
  %29 = load double, ptr %28, align 8, !tbaa !20
  %30 = fadd double %27, %29
  store double %30, ptr %9, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #3
  %31 = getelementptr inbounds %"class.qpl::test::random_base", ptr %12, i32 0, i32 10
  %32 = load double, ptr %31, align 8, !tbaa !21
  %33 = getelementptr inbounds %"class.qpl::test::random_base", ptr %12, i32 0, i32 9
  %34 = load double, ptr %33, align 8, !tbaa !20
  %35 = fadd double %32, %34
  store double %35, ptr %10, align 8, !tbaa !9
  %36 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIdERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %9, ptr noundef nonnull align 8 dereferenceable(8) %10)
  %37 = load double, ptr %36, align 8, !tbaa !9
  %38 = getelementptr inbounds %"class.qpl::test::random_base", ptr %12, i32 0, i32 12
  store double %37, ptr %38, align 8, !tbaa !22
  %39 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIdERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %9, ptr noundef nonnull align 8 dereferenceable(8) %10)
  %40 = load double, ptr %39, align 8, !tbaa !9
  %41 = getelementptr inbounds %"class.qpl::test::random_base", ptr %12, i32 0, i32 11
  store double %40, ptr %41, align 8, !tbaa !23
  %42 = getelementptr inbounds %"class.qpl::test::random_base", ptr %12, i32 0, i32 3
  %43 = load i32, ptr %42, align 4, !tbaa !13
  %44 = getelementptr inbounds %"class.qpl::test::random_base", ptr %12, i32 0, i32 0
  store i32 %43, ptr %44, align 8, !tbaa !24
  %45 = getelementptr inbounds %"class.qpl::test::random_base", ptr %12, i32 0, i32 4
  %46 = load i32, ptr %45, align 8, !tbaa !15
  %47 = getelementptr inbounds %"class.qpl::test::random_base", ptr %12, i32 0, i32 1
  store i32 %46, ptr %47, align 4, !tbaa !25
  %48 = getelementptr inbounds %"class.qpl::test::random_base", ptr %12, i32 0, i32 5
  %49 = load i32, ptr %48, align 4, !tbaa !16
  %50 = getelementptr inbounds %"class.qpl::test::random_base", ptr %12, i32 0, i32 2
  store i32 %49, ptr %50, align 8, !tbaa !26
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #3
  store i32 0, ptr %11, align 4, !tbaa !11
  br label %51

51:                                               ; preds = %57, %4
  %52 = load i32, ptr %11, align 4, !tbaa !11
  %53 = icmp slt i32 %52, 10
  br i1 %53, label %55, label %54

54:                                               ; preds = %51
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #3
  br label %60

55:                                               ; preds = %51
  %56 = call noundef double @_ZN3qpl4test11random_basecvdEv(ptr noundef nonnull align 8 dereferenceable(72) %12)
  br label %57

57:                                               ; preds = %55
  %58 = load i32, ptr %11, align 4, !tbaa !11
  %59 = add nsw i32 %58, 1
  store i32 %59, ptr %11, align 4, !tbaa !11
  br label %51, !llvm.loop !27

60:                                               ; preds = %54
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  ret void
}

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIdERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIdERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #2

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

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

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 = { 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 = !{!"double", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !12, i64 12}
!14 = !{!"_ZTSN3qpl4test11random_baseE", !12, i64 0, !12, i64 4, !12, i64 8, !12, i64 12, !12, i64 16, !12, i64 20, !12, i64 24, !12, i64 28, !12, i64 32, !10, i64 40, !10, i64 48, !10, i64 56, !10, i64 64}
!15 = !{!14, !12, i64 16}
!16 = !{!14, !12, i64 20}
!17 = !{!14, !12, i64 24}
!18 = !{!14, !12, i64 28}
!19 = !{!14, !12, i64 32}
!20 = !{!14, !10, i64 40}
!21 = !{!14, !10, i64 48}
!22 = !{!14, !10, i64 64}
!23 = !{!14, !10, i64 56}
!24 = !{!14, !12, i64 0}
!25 = !{!14, !12, i64 4}
!26 = !{!14, !12, i64 8}
!27 = distinct !{!27, !28}
!28 = !{!"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 void @_ZN3qpl4test11random_baseC2Eddj(ptr noundef nonnull align 8 dereferenceable(72) %0, double noundef %1, double noundef %2, i32 noundef %3) unnamed_addr #0 align 2 {
  %5 = alloca double, align 8
  %6 = alloca double, align 8
  %7 = getelementptr inbounds i8, ptr %0, i64 12
  %8 = getelementptr inbounds i8, ptr %0, i64 20
  store <4 x i32> <i32 41, i32 18467, i32 6334, i32 1>, ptr %7, align 4, !tbaa !5
  %9 = getelementptr inbounds i8, ptr %0, i64 28
  store i32 %3, ptr %9, align 4, !tbaa !9
  %10 = getelementptr inbounds i8, ptr %0, i64 32
  store i32 %3, ptr %10, align 8, !tbaa !12
  %11 = getelementptr inbounds i8, ptr %0, i64 40
  store double %2, ptr %11, align 8, !tbaa !13
  %12 = getelementptr inbounds i8, ptr %0, i64 48
  store double %1, ptr %12, align 8, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #3
  %13 = fsub double %2, %1
  store double %13, ptr %5, align 8, !tbaa !15
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #3
  %14 = fadd double %1, %2
  store double %14, ptr %6, align 8, !tbaa !15
  %15 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIdERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef nonnull align 8 dereferenceable(8) %6)
  %16 = load double, ptr %15, align 8, !tbaa !15
  %17 = getelementptr inbounds i8, ptr %0, i64 64
  store double %16, ptr %17, align 8, !tbaa !16
  %18 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIdERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef nonnull align 8 dereferenceable(8) %6)
  %19 = load double, ptr %18, align 8, !tbaa !15
  %20 = getelementptr inbounds i8, ptr %0, i64 56
  store double %19, ptr %20, align 8, !tbaa !17
  %21 = load <2 x i32>, ptr %7, align 4, !tbaa !5
  store <2 x i32> %21, ptr %0, align 8, !tbaa !5
  %22 = load i32, ptr %8, align 4, !tbaa !18
  %23 = getelementptr inbounds i8, ptr %0, i64 8
  store i32 %22, ptr %23, align 8, !tbaa !19
  %24 = call noundef double @_ZN3qpl4test11random_basecvdEv(ptr noundef nonnull align 8 dereferenceable(72) %0)
  %25 = call noundef double @_ZN3qpl4test11random_basecvdEv(ptr noundef nonnull align 8 dereferenceable(72) %0)
  %26 = call noundef double @_ZN3qpl4test11random_basecvdEv(ptr noundef nonnull align 8 dereferenceable(72) %0)
  %27 = call noundef double @_ZN3qpl4test11random_basecvdEv(ptr noundef nonnull align 8 dereferenceable(72) %0)
  %28 = call noundef double @_ZN3qpl4test11random_basecvdEv(ptr noundef nonnull align 8 dereferenceable(72) %0)
  %29 = call noundef double @_ZN3qpl4test11random_basecvdEv(ptr noundef nonnull align 8 dereferenceable(72) %0)
  %30 = call noundef double @_ZN3qpl4test11random_basecvdEv(ptr noundef nonnull align 8 dereferenceable(72) %0)
  %31 = call noundef double @_ZN3qpl4test11random_basecvdEv(ptr noundef nonnull align 8 dereferenceable(72) %0)
  %32 = call noundef double @_ZN3qpl4test11random_basecvdEv(ptr noundef nonnull align 8 dereferenceable(72) %0)
  %33 = call noundef double @_ZN3qpl4test11random_basecvdEv(ptr noundef nonnull align 8 dereferenceable(72) %0)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #3
  ret void
}

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIdERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIdERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #2

; 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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

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 = { 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !6, i64 28}
!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 32}
!13 = !{!10, !11, i64 40}
!14 = !{!10, !11, i64 48}
!15 = !{!11, !11, i64 0}
!16 = !{!10, !11, i64 64}
!17 = !{!10, !11, i64 56}
!18 = !{!10, !6, i64 20}
!19 = !{!10, !6, i64 8}


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