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

; 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.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] }
%class.ArtificialInmuneSystem = type { %class.Algorithm, ptr, ptr, ptr, ptr, ptr, i32, i32, i64 }
%class.Algorithm = type { ptr }

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 @_ZN15AlgorithmTSPAIS10initializeEv(ptr noundef nonnull align 8 dereferenceable(152) %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 32) #4
  %7 = getelementptr inbounds %class.AlgorithmTSP, ptr %5, i32 0, i32 3
  %8 = load ptr, ptr %7, align 8, !tbaa !9
  %9 = getelementptr inbounds %class.AlgorithmTSP, ptr %5, i32 0, i32 4
  %10 = load ptr, ptr %9, align 8, !tbaa !17
  %11 = getelementptr inbounds %class.AlgorithmTSP, ptr %5, i32 0, i32 5
  %12 = load i32, ptr %11, align 8, !tbaa !18
  invoke void @_ZN10TSPFitnessC1EPPdS1_N12AlgorithmTSP9DATA_TYPEE(ptr noundef nonnull align 8 dereferenceable(28) %6, ptr noundef %8, ptr noundef %10, i32 noundef %12)
          to label %13 unwind label %28

13:                                               ; preds = %1
  %14 = getelementptr inbounds i8, ptr %5, i64 88
  %15 = getelementptr inbounds %class.ArtificialInmuneSystem, ptr %14, i32 0, i32 1
  store ptr %6, ptr %15, align 8, !tbaa !19
  %16 = call noalias noundef nonnull ptr @_Znwm(i64 noundef 32) #4
  invoke void @_ZN11TSPMutationC1Ev(ptr noundef nonnull align 8 dereferenceable(32) %16)
          to label %17 unwind label %32

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

21:                                               ; preds = %17
  %22 = getelementptr inbounds i8, ptr %5, i64 88
  %23 = getelementptr inbounds %class.ArtificialInmuneSystem, 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 @_ZN16TSPStopCriterionC1Ev(ptr noundef nonnull align 8 dereferenceable(16) %24)
          to label %25 unwind label %40

25:                                               ; preds = %21
  %26 = getelementptr inbounds i8, ptr %5, i64 88
  %27 = getelementptr inbounds %class.ArtificialInmuneSystem, ptr %26, i32 0, i32 4
  store ptr %24, ptr %27, align 8, !tbaa !24
  ret void

28:                                               ; preds = %1
  %29 = landingpad { ptr, i32 }
          cleanup
  %30 = extractvalue { ptr, i32 } %29, 0
  store ptr %30, ptr %3, align 8
  %31 = extractvalue { ptr, i32 } %29, 1
  store i32 %31, ptr %4, align 4
  call void @_ZdlPvm(ptr noundef %6, i64 noundef 32) #5
  br label %44

32:                                               ; preds = %13
  %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 %16, i64 noundef 32) #5
  br label %44

36:                                               ; preds = %17
  %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 %20, i64 noundef 16) #5
  br label %44

40:                                               ; preds = %21
  %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 %24, i64 noundef 16) #5
  br label %44

44:                                               ; preds = %40, %36, %32, %28
  %45 = load ptr, ptr %3, align 8
  %46 = load i32, ptr %4, align 4
  %47 = insertvalue { ptr, i32 } poison, ptr %45, 0
  %48 = insertvalue { ptr, i32 } %47, i32 %46, 1
  resume { ptr, i32 } %48
}

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

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 16}
!10 = !{!"_ZTS12AlgorithmTSP", !11, i64 8, !11, i64 12, !6, i64 16, !6, i64 24, !12, i64 32, !13, i64 40, !14, i64 48, !6, i64 80}
!11 = !{!"int", !7, i64 0}
!12 = !{!"_ZTSN12AlgorithmTSP9DATA_TYPEE", !7, i64 0}
!13 = !{!"double", !7, i64 0}
!14 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !15, i64 0, !16, i64 8, !7, i64 16}
!15 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !6, i64 0}
!16 = !{!"long", !7, i64 0}
!17 = !{!10, !6, i64 24}
!18 = !{!10, !12, i64 32}
!19 = !{!20, !6, i64 8}
!20 = !{!"_ZTS22ArtificialInmuneSystem", !21, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !11, i64 48, !11, i64 52, !16, i64 56}
!21 = !{!"_ZTS9Algorithm"}
!22 = !{!20, !6, i64 16}
!23 = !{!20, !6, i64 24}
!24 = !{!20, !6, i64 32}


; 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 @_ZN15AlgorithmTSPAIS10initializeEv(ptr nocapture noundef nonnull align 8 dereferenceable(152) %0) unnamed_addr #1 align 2 personality ptr @__gxx_personality_v0 {
  %2 = tail call noalias noundef nonnull dereferenceable(32) ptr @_Znwm(i64 noundef 32) #4
  %3 = getelementptr inbounds i8, ptr %0, i64 16
  %4 = load ptr, ptr %3, align 8, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %0, i64 24
  %6 = load ptr, ptr %5, align 8, !tbaa !16
  %7 = getelementptr inbounds i8, ptr %0, i64 32
  %8 = load i32, ptr %7, align 8, !tbaa !17
  invoke void @_ZN10TSPFitnessC1EPPdS1_N12AlgorithmTSP9DATA_TYPEE(ptr noundef nonnull align 8 dereferenceable(28) %2, ptr noundef %4, ptr noundef %6, i32 noundef %8)
          to label %9 unwind label %20

9:                                                ; preds = %1
  %10 = getelementptr inbounds i8, ptr %0, i64 96
  store ptr %2, ptr %10, align 8, !tbaa !18
  %11 = tail call noalias noundef nonnull dereferenceable(32) ptr @_Znwm(i64 noundef 32) #4
  invoke void @_ZN11TSPMutationC1Ev(ptr noundef nonnull align 8 dereferenceable(32) %11)
          to label %12 unwind label %22

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

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 @_ZN16TSPStopCriterionC1Ev(ptr noundef nonnull align 8 dereferenceable(16) %17)
          to label %18 unwind label %26

18:                                               ; preds = %15
  %19 = getelementptr inbounds i8, ptr %0, i64 120
  store ptr %17, ptr %19, align 8, !tbaa !23
  ret void

20:                                               ; preds = %1
  %21 = landingpad { ptr, i32 }
          cleanup
  tail call void @_ZdlPvm(ptr noundef nonnull %2, i64 noundef 32) #5
  br label %28

22:                                               ; preds = %9
  %23 = landingpad { ptr, i32 }
          cleanup
  tail call void @_ZdlPvm(ptr noundef nonnull %11, i64 noundef 32) #5
  br label %28

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

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

28:                                               ; preds = %26, %24, %22, %20
  %.pn = phi { ptr, i32 } [ %27, %26 ], [ %25, %24 ], [ %23, %22 ], [ %21, %20 ]
  resume { ptr, i32 } %.pn
}

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

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, !10, i64 16}
!6 = !{!"_ZTS12AlgorithmTSP", !7, i64 8, !7, i64 12, !10, i64 16, !10, i64 24, !11, i64 32, !12, i64 40, !13, i64 48, !10, i64 80}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!"_ZTSN12AlgorithmTSP9DATA_TYPEE", !8, i64 0}
!12 = !{!"double", !8, i64 0}
!13 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !14, i64 0, !15, i64 8, !8, i64 16}
!14 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !10, i64 0}
!15 = !{!"long", !8, i64 0}
!16 = !{!6, !10, i64 24}
!17 = !{!6, !11, i64 32}
!18 = !{!19, !10, i64 8}
!19 = !{!"_ZTS22ArtificialInmuneSystem", !20, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !7, i64 48, !7, i64 52, !15, i64 56}
!20 = !{!"_ZTS9Algorithm"}
!21 = !{!19, !10, i64 16}
!22 = !{!19, !10, i64 24}
!23 = !{!19, !10, i64 32}


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