; LLVM IR from winwinashwin/GA-aided-NMPC-tuning :: src/genetic_algorithm (fitness)

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

%"struct.std::array" = type { [5 x double] }
%"struct.model::Performance" = type { %"class.std::vector", %"class.std::vector", %"class.std::vector", %"class.std::vector", %"class.std::vector", %"class.std::vector" }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl" }
%"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl" = type { %"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl_data" }
%"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl_data" = type { ptr, ptr, ptr }

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN2ga7fitness11ObjFunction11_getMetricsEN5model11PerformanceE(ptr dead_on_unwind noalias writable sret(%"struct.std::array") align 8 %0, ptr noundef nonnull align 8 dereferenceable(96) %1, ptr noundef %2) #0 align 2 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  store ptr %1, ptr %4, align 8, !tbaa !5
  store ptr %2, ptr %5, align 8, !tbaa !5
  %9 = load ptr, ptr %4, align 8
  call void @llvm.memset.p0.i64(ptr align 8 %0, i8 0, i64 40, i1 false)
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  %10 = getelementptr inbounds %"struct.model::Performance", ptr %2, i32 0, i32 1
  %11 = call noundef i64 @_ZNKSt6vectorIdSaIdEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %10) #5
  store i64 %11, ptr %7, align 8, !tbaa !9
  store ptr %7, ptr %6, align 8, !tbaa !5
  %12 = getelementptr inbounds %"struct.model::Performance", ptr %2, i32 0, i32 0
  call void @_ZL9normalizeRSt6vectorIdSaIdEE(ptr noundef nonnull align 8 dereferenceable(24) %12)
  %13 = getelementptr inbounds %"struct.model::Performance", ptr %2, i32 0, i32 2
  call void @_ZL9normalizeRSt6vectorIdSaIdEE(ptr noundef nonnull align 8 dereferenceable(24) %13)
  %14 = getelementptr inbounds %"struct.model::Performance", ptr %2, i32 0, i32 1
  call void @_ZL9normalizeRSt6vectorIdSaIdEE(ptr noundef nonnull align 8 dereferenceable(24) %14)
  %15 = getelementptr inbounds %"struct.model::Performance", ptr %2, i32 0, i32 3
  call void @_ZL9normalizeRSt6vectorIdSaIdEE(ptr noundef nonnull align 8 dereferenceable(24) %15)
  %16 = getelementptr inbounds %"struct.model::Performance", ptr %2, i32 0, i32 4
  call void @_ZL9normalizeRSt6vectorIdSaIdEE(ptr noundef nonnull align 8 dereferenceable(24) %16)
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  store i64 0, ptr %8, align 8, !tbaa !9
  br label %17

17:                                               ; preds = %86, %3
  %18 = load i64, ptr %8, align 8, !tbaa !9
  %19 = load ptr, ptr %6, align 8, !tbaa !5
  %20 = load i64, ptr %19, align 8, !tbaa !9
  %21 = icmp ult i64 %18, %20
  br i1 %21, label %23, label %22

22:                                               ; preds = %17
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  br label %89

23:                                               ; preds = %17
  %24 = load i64, ptr %8, align 8, !tbaa !9
  %25 = add i64 %24, 1
  %26 = getelementptr inbounds %"struct.model::Performance", ptr %2, i32 0, i32 1
  %27 = load i64, ptr %8, align 8, !tbaa !9
  %28 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %26, i64 noundef %27) #5
  %29 = load double, ptr %28, align 8, !tbaa !11
  %30 = fptosi double %29 to i32
  %31 = call i32 @llvm.abs.i32(i32 %30, i1 true)
  %32 = sext i32 %31 to i64
  %33 = mul i64 %25, %32
  %34 = uitofp i64 %33 to double
  %35 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5arrayIdLm5EEixEm(ptr noundef nonnull align 8 dereferenceable(40) %0, i64 noundef 0) #5
  %36 = load double, ptr %35, align 8, !tbaa !11
  %37 = fadd double %36, %34
  store double %37, ptr %35, align 8, !tbaa !11
  %38 = load i64, ptr %8, align 8, !tbaa !9
  %39 = add i64 %38, 1
  %40 = getelementptr inbounds %"struct.model::Performance", ptr %2, i32 0, i32 2
  %41 = load i64, ptr %8, align 8, !tbaa !9
  %42 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %40, i64 noundef %41) #5
  %43 = load double, ptr %42, align 8, !tbaa !11
  %44 = fptosi double %43 to i32
  %45 = call i32 @llvm.abs.i32(i32 %44, i1 true)
  %46 = sext i32 %45 to i64
  %47 = mul i64 %39, %46
  %48 = uitofp i64 %47 to double
  %49 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5arrayIdLm5EEixEm(ptr noundef nonnull align 8 dereferenceable(40) %0, i64 noundef 1) #5
  %50 = load double, ptr %49, align 8, !tbaa !11
  %51 = fadd double %50, %48
  store double %51, ptr %49, align 8, !tbaa !11
  %52 = load i64, ptr %8, align 8, !tbaa !9
  %53 = add i64 %52, 1
  %54 = getelementptr inbounds %"struct.model::Performance", ptr %2, i32 0, i32 0
  %55 = load i64, ptr %8, align 8, !tbaa !9
  %56 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %54, i64 noundef %55) #5
  %57 = load double, ptr %56, align 8, !tbaa !11
  %58 = fptosi double %57 to i32
  %59 = call i32 @llvm.abs.i32(i32 %58, i1 true)
  %60 = sext i32 %59 to i64
  %61 = mul i64 %53, %60
  %62 = uitofp i64 %61 to double
  %63 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5arrayIdLm5EEixEm(ptr noundef nonnull align 8 dereferenceable(40) %0, i64 noundef 2) #5
  %64 = load double, ptr %63, align 8, !tbaa !11
  %65 = fadd double %64, %62
  store double %65, ptr %63, align 8, !tbaa !11
  %66 = getelementptr inbounds %"struct.model::Performance", ptr %2, i32 0, i32 3
  %67 = load i64, ptr %8, align 8, !tbaa !9
  %68 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %66, i64 noundef %67) #5
  %69 = load double, ptr %68, align 8, !tbaa !11
  %70 = fptosi double %69 to i32
  %71 = call i32 @llvm.abs.i32(i32 %70, i1 true)
  %72 = sitofp i32 %71 to double
  %73 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5arrayIdLm5EEixEm(ptr noundef nonnull align 8 dereferenceable(40) %0, i64 noundef 3) #5
  %74 = load double, ptr %73, align 8, !tbaa !11
  %75 = fadd double %74, %72
  store double %75, ptr %73, align 8, !tbaa !11
  %76 = getelementptr inbounds %"struct.model::Performance", ptr %2, i32 0, i32 4
  %77 = load i64, ptr %8, align 8, !tbaa !9
  %78 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %76, i64 noundef %77) #5
  %79 = load double, ptr %78, align 8, !tbaa !11
  %80 = fptosi double %79 to i32
  %81 = call i32 @llvm.abs.i32(i32 %80, i1 true)
  %82 = sitofp i32 %81 to double
  %83 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5arrayIdLm5EEixEm(ptr noundef nonnull align 8 dereferenceable(40) %0, i64 noundef 4) #5
  %84 = load double, ptr %83, align 8, !tbaa !11
  %85 = fadd double %84, %82
  store double %85, ptr %83, align 8, !tbaa !11
  br label %86

86:                                               ; preds = %23
  %87 = load i64, ptr %8, align 8, !tbaa !9
  %88 = add i64 %87, 1
  store i64 %88, ptr %8, align 8, !tbaa !9
  br label %17, !llvm.loop !13

89:                                               ; preds = %22
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #5
  ret void
}

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #1

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorIdSaIdEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) #3 align 2

; Function Attrs: mustprogress uwtable
declare hidden void @_ZL9normalizeRSt6vectorIdSaIdEE(ptr noundef nonnull align 8 dereferenceable(24)) #0

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #4

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5arrayIdLm5EEixEm(ptr noundef nonnull align 8 dereferenceable(40), i64 noundef) #3 align 2

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

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 nounwind willreturn memory(argmem: write) }
attributes #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { 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 = !{!"long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"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"

%"struct.std::array" = type { [5 x double] }

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN2ga7fitness11ObjFunction11_getMetricsEN5model11PerformanceE(ptr dead_on_unwind noalias writable sret(%"struct.std::array") align 8 %0, ptr nocapture noundef nonnull readnone align 8 dereferenceable(96) %1, ptr noundef %2) local_unnamed_addr #0 align 2 {
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(40) %0, i8 0, i64 40, i1 false)
  %4 = getelementptr inbounds i8, ptr %2, i64 24
  %5 = tail call noundef i64 @_ZNKSt6vectorIdSaIdEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %4) #4
  tail call void @_ZL9normalizeRSt6vectorIdSaIdEE(ptr noundef nonnull align 8 dereferenceable(24) %2)
  %6 = getelementptr inbounds i8, ptr %2, i64 48
  tail call void @_ZL9normalizeRSt6vectorIdSaIdEE(ptr noundef nonnull align 8 dereferenceable(24) %6)
  tail call void @_ZL9normalizeRSt6vectorIdSaIdEE(ptr noundef nonnull align 8 dereferenceable(24) %4)
  %7 = getelementptr inbounds i8, ptr %2, i64 72
  tail call void @_ZL9normalizeRSt6vectorIdSaIdEE(ptr noundef nonnull align 8 dereferenceable(24) %7)
  %8 = getelementptr inbounds i8, ptr %2, i64 96
  tail call void @_ZL9normalizeRSt6vectorIdSaIdEE(ptr noundef nonnull align 8 dereferenceable(24) %8)
  %.not = icmp eq i64 %5, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %.lr.ph, %3
  ret void

.lr.ph:                                           ; preds = %3, %.lr.ph
  %.011 = phi i64 [ %9, %.lr.ph ], [ 0, %3 ]
  %9 = add nuw i64 %.011, 1
  %10 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %.011) #4
  %11 = load double, ptr %10, align 8, !tbaa !5
  %12 = fptosi double %11 to i32
  %13 = tail call i32 @llvm.abs.i32(i32 %12, i1 true)
  %14 = zext nneg i32 %13 to i64
  %15 = mul i64 %9, %14
  %16 = uitofp i64 %15 to double
  %17 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5arrayIdLm5EEixEm(ptr noundef nonnull align 8 dereferenceable(40) %0, i64 noundef 0) #4
  %18 = load double, ptr %17, align 8, !tbaa !5
  %19 = fadd double %18, %16
  store double %19, ptr %17, align 8, !tbaa !5
  %20 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %6, i64 noundef %.011) #4
  %21 = load double, ptr %20, align 8, !tbaa !5
  %22 = fptosi double %21 to i32
  %23 = tail call i32 @llvm.abs.i32(i32 %22, i1 true)
  %24 = zext nneg i32 %23 to i64
  %25 = mul i64 %9, %24
  %26 = uitofp i64 %25 to double
  %27 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5arrayIdLm5EEixEm(ptr noundef nonnull align 8 dereferenceable(40) %0, i64 noundef 1) #4
  %28 = load double, ptr %27, align 8, !tbaa !5
  %29 = fadd double %28, %26
  store double %29, ptr %27, align 8, !tbaa !5
  %30 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef %.011) #4
  %31 = load double, ptr %30, align 8, !tbaa !5
  %32 = fptosi double %31 to i32
  %33 = tail call i32 @llvm.abs.i32(i32 %32, i1 true)
  %34 = zext nneg i32 %33 to i64
  %35 = mul i64 %9, %34
  %36 = uitofp i64 %35 to double
  %37 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5arrayIdLm5EEixEm(ptr noundef nonnull align 8 dereferenceable(40) %0, i64 noundef 2) #4
  %38 = load double, ptr %37, align 8, !tbaa !5
  %39 = fadd double %38, %36
  store double %39, ptr %37, align 8, !tbaa !5
  %40 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %7, i64 noundef %.011) #4
  %41 = load double, ptr %40, align 8, !tbaa !5
  %42 = fptosi double %41 to i32
  %43 = tail call i32 @llvm.abs.i32(i32 %42, i1 true)
  %44 = uitofp nneg i32 %43 to double
  %45 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5arrayIdLm5EEixEm(ptr noundef nonnull align 8 dereferenceable(40) %0, i64 noundef 3) #4
  %46 = load double, ptr %45, align 8, !tbaa !5
  %47 = fadd double %46, %44
  store double %47, ptr %45, align 8, !tbaa !5
  %48 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %8, i64 noundef %.011) #4
  %49 = load double, ptr %48, align 8, !tbaa !5
  %50 = fptosi double %49 to i32
  %51 = tail call i32 @llvm.abs.i32(i32 %50, i1 true)
  %52 = uitofp nneg i32 %51 to double
  %53 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5arrayIdLm5EEixEm(ptr noundef nonnull align 8 dereferenceable(40) %0, i64 noundef 4) #4
  %54 = load double, ptr %53, align 8, !tbaa !5
  %55 = fadd double %54, %52
  store double %55, ptr %53, align 8, !tbaa !5
  %exitcond.not = icmp eq i64 %9, %5
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph, !llvm.loop !9
}

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorIdSaIdEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare hidden void @_ZL9normalizeRSt6vectorIdSaIdEE(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #0

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

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #3

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

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 nounwind willreturn memory(argmem: write) }
attributes #2 = { 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 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass