; LLVM IR from jorgemf/c-evolutionary-library :: examples/tsp/AlgorithmTSPGA.ll (ZN14AlgorithmTSPGA10initializeEv)

; 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.GeneticAlgorithm = type <{ %class.Algorithm, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, i64, i32, i32, i32, [4 x i8] }>
%class.Algorithm = type { ptr }
%class.AlgorithmTSP = type { ptr, i32, i32, ptr, ptr, i32, double, %"class.std::__cxx11::basic_string", ptr }
%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }

declare i32 @__gxx_personality_v0(...)

; Function Attrs: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, i64 noundef) #0

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN14AlgorithmTSPGA10initializeEv(ptr noundef nonnull align 8 dereferenceable(180) %0) unnamed_addr #1 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  %5 = load ptr, ptr %2, align 8
  %6 = call noalias noundef nonnull ptr @_Znwm(i64 noundef 8) #4
  invoke void @_ZN12TSPCrossoverC1Ev(ptr noundef nonnull align 8 dereferenceable(8) %6)
          to label %7 unwind label %32

7:                                                ; preds = %1
  %8 = getelementptr inbounds i8, ptr %5, i64 88
  %9 = getelementptr inbounds %class.GeneticAlgorithm, ptr %8, i32 0, i32 1
  store ptr %6, ptr %9, align 8, !tbaa !9
  %10 = call noalias noundef nonnull ptr @_Znwm(i64 noundef 32) #4
  %11 = getelementptr inbounds %class.AlgorithmTSP, ptr %5, i32 0, i32 3
  %12 = load ptr, ptr %11, align 8, !tbaa !14
  %13 = getelementptr inbounds %class.AlgorithmTSP, ptr %5, i32 0, i32 4
  %14 = load ptr, ptr %13, align 8, !tbaa !20
  %15 = getelementptr inbounds %class.AlgorithmTSP, ptr %5, i32 0, i32 5
  %16 = load i32, ptr %15, align 8, !tbaa !21
  invoke void @_ZN10TSPFitnessC1EPPdS1_N12AlgorithmTSP9DATA_TYPEE(ptr noundef nonnull align 8 dereferenceable(28) %10, ptr noundef %12, ptr noundef %14, i32 noundef %16)
          to label %17 unwind label %36

17:                                               ; preds = %7
  %18 = getelementptr inbounds i8, ptr %5, i64 88
  %19 = getelementptr inbounds %class.GeneticAlgorithm, ptr %18, i32 0, i32 2
  store ptr %10, ptr %19, align 8, !tbaa !22
  %20 = call noalias noundef nonnull ptr @_Znwm(i64 noundef 32) #4
  invoke void @_ZN11TSPMutationC1Ev(ptr noundef nonnull align 8 dereferenceable(32) %20)
          to label %21 unwind label %40

21:                                               ; preds = %17
  %22 = getelementptr inbounds i8, ptr %5, i64 88
  %23 = getelementptr inbounds %class.GeneticAlgorithm, ptr %22, i32 0, i32 3
  store ptr %20, ptr %23, align 8, !tbaa !23
  %24 = call noalias noundef nonnull ptr @_Znwm(i64 noundef 16) #4
  invoke void @_ZN12TSPSelectionC1Ev(ptr noundef nonnull align 8 dereferenceable(16) %24)
          to label %25 unwind label %44

25:                                               ; preds = %21
  %26 = getelementptr inbounds i8, ptr %5, i64 88
  %27 = getelementptr inbounds %class.GeneticAlgorithm, ptr %26, i32 0, i32 4
  store ptr %24, ptr %27, align 8, !tbaa !24
  %28 = call noalias noundef nonnull ptr @_Znwm(i64 noundef 16) #4
  invoke void @_ZN16TSPStopCriterionC1Ev(ptr noundef nonnull align 8 dereferenceable(16) %28)
          to label %29 unwind label %48

29:                                               ; preds = %25
  %30 = getelementptr inbounds i8, ptr %5, i64 88
  %31 = getelementptr inbounds %class.GeneticAlgorithm, ptr %30, i32 0, i32 5
  store ptr %28, ptr %31, align 8, !tbaa !25
  ret void

32:                                               ; preds = %1
  %33 = landingpad { ptr, i32 }
          cleanup
  %34 = extractvalue { ptr, i32 } %33, 0
  store ptr %34, ptr %3, align 8
  %35 = extractvalue { ptr, i32 } %33, 1
  store i32 %35, ptr %4, align 4
  call void @_ZdlPvm(ptr noundef %6, i64 noundef 8) #5
  br label %52

36:                                               ; preds = %7
  %37 = landingpad { ptr, i32 }
          cleanup
  %38 = extractvalue { ptr, i32 } %37, 0
  store ptr %38, ptr %3, align 8
  %39 = extractvalue { ptr, i32 } %37, 1
  store i32 %39, ptr %4, align 4
  call void @_ZdlPvm(ptr noundef %10, i64 noundef 32) #5
  br label %52

40:                                               ; preds = %17
  %41 = landingpad { ptr, i32 }
          cleanup
  %42 = extractvalue { ptr, i32 } %41, 0
  store ptr %42, ptr %3, align 8
  %43 = extractvalue { ptr, i32 } %41, 1
  store i32 %43, ptr %4, align 4
  call void @_ZdlPvm(ptr noundef %20, i64 noundef 32) #5
  br label %52

44:                                               ; preds = %21
  %45 = landingpad { ptr, i32 }
          cleanup
  %46 = extractvalue { ptr, i32 } %45, 0
  store ptr %46, ptr %3, align 8
  %47 = extractvalue { ptr, i32 } %45, 1
  store i32 %47, ptr %4, align 4
  call void @_ZdlPvm(ptr noundef %24, i64 noundef 16) #5
  br label %52

48:                                               ; preds = %25
  %49 = landingpad { ptr, i32 }
          cleanup
  %50 = extractvalue { ptr, i32 } %49, 0
  store ptr %50, ptr %3, align 8
  %51 = extractvalue { ptr, i32 } %49, 1
  store i32 %51, ptr %4, align 4
  call void @_ZdlPvm(ptr noundef %28, i64 noundef 16) #5
  br label %52

52:                                               ; preds = %48, %44, %40, %36, %32
  %53 = load ptr, ptr %3, align 8
  %54 = load i32, ptr %4, align 4
  %55 = insertvalue { ptr, i32 } poison, ptr %53, 0
  %56 = insertvalue { ptr, i32 } %55, i32 %54, 1
  resume { ptr, i32 } %56
}

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

declare void @_ZN12TSPCrossoverC1Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #3

declare void @_ZN10TSPFitnessC1EPPdS1_N12AlgorithmTSP9DATA_TYPEE(ptr noundef nonnull align 8 dereferenceable(28), ptr noundef, ptr noundef, i32 noundef) unnamed_addr #3

declare void @_ZN11TSPMutationC1Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #3

declare void @_ZN12TSPSelectionC1Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #3

declare void @_ZN16TSPStopCriterionC1Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #3

attributes #0 = { 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 #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 = { 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 #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 = { builtin allocsize(0) }
attributes #5 = { 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 = !{!10, !6, i64 8}
!10 = !{!"_ZTS16GeneticAlgorithm", !11, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !12, i64 64, !12, i64 68, !13, i64 72, !12, i64 80, !12, i64 84, !12, i64 88}
!11 = !{!"_ZTS9Algorithm"}
!12 = !{!"int", !7, i64 0}
!13 = !{!"long", !7, i64 0}
!14 = !{!15, !6, i64 16}
!15 = !{!"_ZTS12AlgorithmTSP", !12, i64 8, !12, i64 12, !6, i64 16, !6, i64 24, !16, i64 32, !17, i64 40, !18, i64 48, !6, i64 80}
!16 = !{!"_ZTSN12AlgorithmTSP9DATA_TYPEE", !7, i64 0}
!17 = !{!"double", !7, i64 0}
!18 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !19, i64 0, !13, i64 8, !7, i64 16}
!19 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !6, i64 0}
!20 = !{!15, !6, i64 24}
!21 = !{!15, !16, i64 32}
!22 = !{!10, !6, i64 16}
!23 = !{!10, !6, i64 24}
!24 = !{!10, !6, i64 32}
!25 = !{!10, !6, i64 40}


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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, i64 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN14AlgorithmTSPGA10initializeEv(ptr nocapture noundef nonnull align 8 dereferenceable(180) %0) unnamed_addr #1 align 2 personality ptr @__gxx_personality_v0 {
  %2 = tail call noalias noundef nonnull dereferenceable(8) ptr @_Znwm(i64 noundef 8) #4
  invoke void @_ZN12TSPCrossoverC1Ev(ptr noundef nonnull align 8 dereferenceable(8) %2)
          to label %3 unwind label %23

3:                                                ; preds = %1
  %4 = getelementptr inbounds i8, ptr %0, i64 96
  store ptr %2, ptr %4, align 8, !tbaa !5
  %5 = tail call noalias noundef nonnull dereferenceable(32) ptr @_Znwm(i64 noundef 32) #4
  %6 = getelementptr inbounds i8, ptr %0, i64 16
  %7 = load ptr, ptr %6, align 8, !tbaa !13
  %8 = getelementptr inbounds i8, ptr %0, i64 24
  %9 = load ptr, ptr %8, align 8, !tbaa !19
  %10 = getelementptr inbounds i8, ptr %0, i64 32
  %11 = load i32, ptr %10, align 8, !tbaa !20
  invoke void @_ZN10TSPFitnessC1EPPdS1_N12AlgorithmTSP9DATA_TYPEE(ptr noundef nonnull align 8 dereferenceable(28) %5, ptr noundef %7, ptr noundef %9, i32 noundef %11)
          to label %12 unwind label %25

12:                                               ; preds = %3
  %13 = getelementptr inbounds i8, ptr %0, i64 104
  store ptr %5, ptr %13, align 8, !tbaa !21
  %14 = tail call noalias noundef nonnull dereferenceable(32) ptr @_Znwm(i64 noundef 32) #4
  invoke void @_ZN11TSPMutationC1Ev(ptr noundef nonnull align 8 dereferenceable(32) %14)
          to label %15 unwind label %27

15:                                               ; preds = %12
  %16 = getelementptr inbounds i8, ptr %0, i64 112
  store ptr %14, ptr %16, align 8, !tbaa !22
  %17 = tail call noalias noundef nonnull dereferenceable(16) ptr @_Znwm(i64 noundef 16) #4
  invoke void @_ZN12TSPSelectionC1Ev(ptr noundef nonnull align 8 dereferenceable(16) %17)
          to label %18 unwind label %29

18:                                               ; preds = %15
  %19 = getelementptr inbounds i8, ptr %0, i64 120
  store ptr %17, ptr %19, align 8, !tbaa !23
  %20 = tail call noalias noundef nonnull dereferenceable(16) ptr @_Znwm(i64 noundef 16) #4
  invoke void @_ZN16TSPStopCriterionC1Ev(ptr noundef nonnull align 8 dereferenceable(16) %20)
          to label %21 unwind label %31

21:                                               ; preds = %18
  %22 = getelementptr inbounds i8, ptr %0, i64 128
  store ptr %20, ptr %22, align 8, !tbaa !24
  ret void

23:                                               ; preds = %1
  %24 = landingpad { ptr, i32 }
          cleanup
  tail call void @_ZdlPvm(ptr noundef nonnull %2, i64 noundef 8) #5
  br label %33

25:                                               ; preds = %3
  %26 = landingpad { ptr, i32 }
          cleanup
  tail call void @_ZdlPvm(ptr noundef nonnull %5, i64 noundef 32) #5
  br label %33

27:                                               ; preds = %12
  %28 = landingpad { ptr, i32 }
          cleanup
  tail call void @_ZdlPvm(ptr noundef nonnull %14, i64 noundef 32) #5
  br label %33

29:                                               ; preds = %15
  %30 = landingpad { ptr, i32 }
          cleanup
  tail call void @_ZdlPvm(ptr noundef nonnull %17, i64 noundef 16) #5
  br label %33

31:                                               ; preds = %18
  %32 = landingpad { ptr, i32 }
          cleanup
  tail call void @_ZdlPvm(ptr noundef nonnull %20, i64 noundef 16) #5
  br label %33

33:                                               ; preds = %31, %29, %27, %25, %23
  %.pn = phi { ptr, i32 } [ %32, %31 ], [ %30, %29 ], [ %28, %27 ], [ %26, %25 ], [ %24, %23 ]
  resume { ptr, i32 } %.pn
}

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

declare void @_ZN12TSPCrossoverC1Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #3

declare void @_ZN10TSPFitnessC1EPPdS1_N12AlgorithmTSP9DATA_TYPEE(ptr noundef nonnull align 8 dereferenceable(28), ptr noundef, ptr noundef, i32 noundef) unnamed_addr #3

declare void @_ZN11TSPMutationC1Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #3

declare void @_ZN12TSPSelectionC1Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #3

declare void @_ZN16TSPStopCriterionC1Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #3

attributes #0 = { 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 #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 = { 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 #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 = { builtin allocsize(0) }
attributes #5 = { 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, !8, i64 8}
!6 = !{!"_ZTS16GeneticAlgorithm", !7, i64 0, !8, i64 8, !8, i64 16, !8, i64 24, !8, i64 32, !8, i64 40, !8, i64 48, !8, i64 56, !11, i64 64, !11, i64 68, !12, i64 72, !11, i64 80, !11, i64 84, !11, i64 88}
!7 = !{!"_ZTS9Algorithm"}
!8 = !{!"any pointer", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = !{!"int", !9, i64 0}
!12 = !{!"long", !9, i64 0}
!13 = !{!14, !8, i64 16}
!14 = !{!"_ZTS12AlgorithmTSP", !11, i64 8, !11, i64 12, !8, i64 16, !8, i64 24, !15, i64 32, !16, i64 40, !17, i64 48, !8, i64 80}
!15 = !{!"_ZTSN12AlgorithmTSP9DATA_TYPEE", !9, i64 0}
!16 = !{!"double", !9, i64 0}
!17 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !18, i64 0, !12, i64 8, !9, i64 16}
!18 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !8, i64 0}
!19 = !{!14, !8, i64 24}
!20 = !{!14, !15, i64 32}
!21 = !{!6, !8, i64 16}
!22 = !{!6, !8, i64 24}
!23 = !{!6, !8, i64 32}
!24 = !{!6, !8, i64 40}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,TailCallElimPass