; LLVM IR from alenic/realGA :: src/realga.ll (ZN6RealGA19popInitRandGaussianEff)

; 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.RealGA = type { ptr, %"class.std::vector", %"class.std::vector", %"class.std::vector.0", %"class.std::vector.0", %class.RealGAOptions, ptr, %"class.std::vector", float, i32, ptr, ptr, ptr, i32, float }
%"class.std::vector.0" = type { %"struct.std::_Vector_base.1" }
%"struct.std::_Vector_base.1" = type { %"struct.std::_Vector_base<RealChromosome, std::allocator<RealChromosome>>::_Vector_impl" }
%"struct.std::_Vector_base<RealChromosome, std::allocator<RealChromosome>>::_Vector_impl" = type { %"struct.std::_Vector_base<RealChromosome, std::allocator<RealChromosome>>::_Vector_impl_data" }
%"struct.std::_Vector_base<RealChromosome, std::allocator<RealChromosome>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%class.RealGAOptions = type { i64, i64, %"class.std::vector", %"class.std::vector", i32, i32, float, i8, i32, i32, float, i32, i32, i32, float, float, float, float }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<float, std::allocator<float>>::_Vector_impl" }
%"struct.std::_Vector_base<float, std::allocator<float>>::_Vector_impl" = type { %"struct.std::_Vector_base<float, std::allocator<float>>::_Vector_impl_data" }
%"struct.std::_Vector_base<float, std::allocator<float>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%class.RealChromosome = type <{ %"class.std::vector", float, [4 x i8] }>

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(28) ptr @_ZNSt6vectorI14RealChromosomeSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef float @_ZN6RealGA11evalFitnessERK14RealChromosome(ptr noundef nonnull align 8 dereferenceable(296), ptr noundef nonnull align 8 dereferenceable(28)) #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN6RealGA19popInitRandGaussianEff(ptr noundef nonnull align 8 dereferenceable(296) %0, float noundef %1, float noundef %2) #2 align 2 {
  %4 = alloca ptr, align 8
  %5 = alloca float, align 4
  %6 = alloca float, align 4
  %7 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store float %1, ptr %5, align 4, !tbaa !9
  store float %2, ptr %6, align 4, !tbaa !9
  %8 = load ptr, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  store i32 0, ptr %7, align 4, !tbaa !11
  br label %9

9:                                                ; preds = %36, %3
  %10 = load i32, ptr %7, align 4, !tbaa !11
  %11 = sext i32 %10 to i64
  %12 = getelementptr inbounds %class.RealGA, ptr %8, i32 0, i32 5
  %13 = getelementptr inbounds %class.RealGAOptions, ptr %12, i32 0, i32 0
  %14 = load i64, ptr %13, align 8, !tbaa !13
  %15 = icmp ult i64 %11, %14
  br i1 %15, label %17, label %16

16:                                               ; preds = %9
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  br label %39

17:                                               ; preds = %9
  %18 = getelementptr inbounds %class.RealGA, ptr %8, i32 0, i32 3
  %19 = load i32, ptr %7, align 4, !tbaa !11
  %20 = sext i32 %19 to i64
  %21 = call noundef nonnull align 8 dereferenceable(28) ptr @_ZNSt6vectorI14RealChromosomeSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %18, i64 noundef %20) #4
  %22 = load float, ptr %5, align 4, !tbaa !9
  %23 = load float, ptr %6, align 4, !tbaa !9
  %24 = getelementptr inbounds %class.RealGA, ptr %8, i32 0, i32 1
  %25 = getelementptr inbounds %class.RealGA, ptr %8, i32 0, i32 2
  call void @_ZN14RealChromosome12randGaussianEffRSt6vectorIfSaIfEES3_(ptr noundef nonnull align 8 dereferenceable(28) %21, float noundef %22, float noundef %23, ptr noundef nonnull align 8 dereferenceable(24) %24, ptr noundef nonnull align 8 dereferenceable(24) %25)
  %26 = getelementptr inbounds %class.RealGA, ptr %8, i32 0, i32 3
  %27 = load i32, ptr %7, align 4, !tbaa !11
  %28 = sext i32 %27 to i64
  %29 = call noundef nonnull align 8 dereferenceable(28) ptr @_ZNSt6vectorI14RealChromosomeSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %26, i64 noundef %28) #4
  %30 = call noundef float @_ZN6RealGA11evalFitnessERK14RealChromosome(ptr noundef nonnull align 8 dereferenceable(296) %8, ptr noundef nonnull align 8 dereferenceable(28) %29)
  %31 = getelementptr inbounds %class.RealGA, ptr %8, i32 0, i32 3
  %32 = load i32, ptr %7, align 4, !tbaa !11
  %33 = sext i32 %32 to i64
  %34 = call noundef nonnull align 8 dereferenceable(28) ptr @_ZNSt6vectorI14RealChromosomeSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %31, i64 noundef %33) #4
  %35 = getelementptr inbounds %class.RealChromosome, ptr %34, i32 0, i32 1
  store float %30, ptr %35, align 8, !tbaa !30
  br label %36

36:                                               ; preds = %17
  %37 = load i32, ptr %7, align 4, !tbaa !11
  %38 = add nsw i32 %37, 1
  store i32 %38, ptr %7, align 4, !tbaa !11
  br label %9, !llvm.loop !32

39:                                               ; preds = %16
  ret void
}

declare void @_ZN14RealChromosome12randGaussianEffRSt6vectorIfSaIfEES3_(ptr noundef nonnull align 8 dereferenceable(28), float noundef, float noundef, ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) #3

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 = { "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 = { 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 = !{!"float", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !24, i64 104}
!14 = !{!"_ZTS6RealGA", !15, i64 8, !15, i64 32, !19, i64 56, !19, i64 80, !23, i64 104, !6, i64 224, !15, i64 232, !10, i64 256, !12, i64 260, !6, i64 264, !6, i64 272, !6, i64 280, !12, i64 288, !10, i64 292}
!15 = !{!"_ZTSSt6vectorIfSaIfEE", !16, i64 0}
!16 = !{!"_ZTSSt12_Vector_baseIfSaIfEE", !17, i64 0}
!17 = !{!"_ZTSNSt12_Vector_baseIfSaIfEE12_Vector_implE", !18, i64 0}
!18 = !{!"_ZTSNSt12_Vector_baseIfSaIfEE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!19 = !{!"_ZTSSt6vectorI14RealChromosomeSaIS0_EE", !20, i64 0}
!20 = !{!"_ZTSSt12_Vector_baseI14RealChromosomeSaIS0_EE", !21, i64 0}
!21 = !{!"_ZTSNSt12_Vector_baseI14RealChromosomeSaIS0_EE12_Vector_implE", !22, i64 0}
!22 = !{!"_ZTSNSt12_Vector_baseI14RealChromosomeSaIS0_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!23 = !{!"_ZTS13RealGAOptions", !24, i64 0, !24, i64 8, !15, i64 16, !15, i64 40, !12, i64 64, !25, i64 68, !10, i64 72, !26, i64 76, !27, i64 80, !12, i64 84, !10, i64 88, !28, i64 92, !12, i64 96, !29, i64 100, !10, i64 104, !10, i64 108, !10, i64 112, !10, i64 116}
!24 = !{!"long", !7, i64 0}
!25 = !{!"_ZTS11VerboseType", !7, i64 0}
!26 = !{!"bool", !7, i64 0}
!27 = !{!"_ZTS13SelectionType", !7, i64 0}
!28 = !{!"_ZTS13CrossoverType", !7, i64 0}
!29 = !{!"_ZTS12MutationType", !7, i64 0}
!30 = !{!31, !10, i64 24}
!31 = !{!"_ZTS14RealChromosome", !15, i64 0, !10, i64 24}
!32 = distinct !{!32, !33}
!33 = !{!"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 nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(28) ptr @_ZNSt6vectorI14RealChromosomeSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef float @_ZN6RealGA11evalFitnessERK14RealChromosome(ptr noundef nonnull align 8 dereferenceable(296), ptr noundef nonnull align 8 dereferenceable(28)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN6RealGA19popInitRandGaussianEff(ptr noundef nonnull align 8 dereferenceable(296) %0, float noundef %1, float noundef %2) local_unnamed_addr #1 align 2 {
  %4 = getelementptr inbounds i8, ptr %0, i64 104
  %5 = load i64, ptr %4, align 8, !tbaa !5
  %.not = icmp eq i64 %5, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %3
  %6 = getelementptr inbounds i8, ptr %0, i64 56
  %7 = getelementptr inbounds i8, ptr %0, i64 8
  %8 = getelementptr inbounds i8, ptr %0, i64 32
  br label %9

._crit_edge:                                      ; preds = %9, %3
  ret void

9:                                                ; preds = %.lr.ph, %9
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %9 ]
  %10 = tail call noundef nonnull align 8 dereferenceable(28) ptr @_ZNSt6vectorI14RealChromosomeSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %6, i64 noundef %indvars.iv) #3
  tail call void @_ZN14RealChromosome12randGaussianEffRSt6vectorIfSaIfEES3_(ptr noundef nonnull align 8 dereferenceable(28) %10, float noundef %1, float noundef %2, ptr noundef nonnull align 8 dereferenceable(24) %7, ptr noundef nonnull align 8 dereferenceable(24) %8)
  %11 = tail call noundef nonnull align 8 dereferenceable(28) ptr @_ZNSt6vectorI14RealChromosomeSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %6, i64 noundef %indvars.iv) #3
  %12 = tail call noundef float @_ZN6RealGA11evalFitnessERK14RealChromosome(ptr noundef nonnull align 8 dereferenceable(296) %0, ptr noundef nonnull align 8 dereferenceable(28) %11)
  %13 = tail call noundef nonnull align 8 dereferenceable(28) ptr @_ZNSt6vectorI14RealChromosomeSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %6, i64 noundef %indvars.iv) #3
  %14 = getelementptr inbounds i8, ptr %13, i64 24
  store float %12, ptr %14, align 8, !tbaa !27
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %15 = load i64, ptr %4, align 8, !tbaa !5
  %16 = icmp ugt i64 %15, %indvars.iv.next
  br i1 %16, label %9, label %._crit_edge, !llvm.loop !29
}

declare void @_ZN14RealChromosome12randGaussianEffRSt6vectorIfSaIfEES3_(ptr noundef nonnull align 8 dereferenceable(28), float noundef, float noundef, ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #2

attributes #0 = { 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 #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 = { "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, !19, i64 104}
!6 = !{!"_ZTS6RealGA", !7, i64 8, !7, i64 32, !14, i64 56, !14, i64 80, !18, i64 104, !11, i64 224, !7, i64 232, !22, i64 256, !20, i64 260, !11, i64 264, !11, i64 272, !11, i64 280, !20, i64 288, !22, i64 292}
!7 = !{!"_ZTSSt6vectorIfSaIfEE", !8, i64 0}
!8 = !{!"_ZTSSt12_Vector_baseIfSaIfEE", !9, i64 0}
!9 = !{!"_ZTSNSt12_Vector_baseIfSaIfEE12_Vector_implE", !10, i64 0}
!10 = !{!"_ZTSNSt12_Vector_baseIfSaIfEE17_Vector_impl_dataE", !11, i64 0, !11, i64 8, !11, i64 16}
!11 = !{!"any pointer", !12, i64 0}
!12 = !{!"omnipotent char", !13, i64 0}
!13 = !{!"Simple C++ TBAA"}
!14 = !{!"_ZTSSt6vectorI14RealChromosomeSaIS0_EE", !15, i64 0}
!15 = !{!"_ZTSSt12_Vector_baseI14RealChromosomeSaIS0_EE", !16, i64 0}
!16 = !{!"_ZTSNSt12_Vector_baseI14RealChromosomeSaIS0_EE12_Vector_implE", !17, i64 0}
!17 = !{!"_ZTSNSt12_Vector_baseI14RealChromosomeSaIS0_EE17_Vector_impl_dataE", !11, i64 0, !11, i64 8, !11, i64 16}
!18 = !{!"_ZTS13RealGAOptions", !19, i64 0, !19, i64 8, !7, i64 16, !7, i64 40, !20, i64 64, !21, i64 68, !22, i64 72, !23, i64 76, !24, i64 80, !20, i64 84, !22, i64 88, !25, i64 92, !20, i64 96, !26, i64 100, !22, i64 104, !22, i64 108, !22, i64 112, !22, i64 116}
!19 = !{!"long", !12, i64 0}
!20 = !{!"int", !12, i64 0}
!21 = !{!"_ZTS11VerboseType", !12, i64 0}
!22 = !{!"float", !12, i64 0}
!23 = !{!"bool", !12, i64 0}
!24 = !{!"_ZTS13SelectionType", !12, i64 0}
!25 = !{!"_ZTS13CrossoverType", !12, i64 0}
!26 = !{!"_ZTS12MutationType", !12, i64 0}
!27 = !{!28, !22, i64 24}
!28 = !{!"_ZTS14RealChromosome", !7, i64 0, !22, i64 24}
!29 = distinct !{!29, !30}
!30 = !{!"llvm.loop.mustprogress"}


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