; LLVM IR from jorgemf/c-evolutionary-library :: src/Individual.ll (ZN10Individual4copyEPS_)

; 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.Individual = type <{ ptr, i8, [7 x i8], double, i32, [4 x i8], double, ptr, i32, [4 x i8] }>

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare { i64, i1 } @llvm.umul.with.overflow.i64(i64, i64) #0

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN10Individual4copyEPS_(ptr noundef nonnull align 8 dereferenceable(52) %0, ptr noundef %1) unnamed_addr #3 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %6 = load ptr, ptr %3, align 8
  %7 = getelementptr inbounds %class.Individual, ptr %6, i32 0, i32 3
  %8 = load double, ptr %7, align 8, !tbaa !9
  %9 = load ptr, ptr %4, align 8, !tbaa !5
  %10 = getelementptr inbounds %class.Individual, ptr %9, i32 0, i32 3
  store double %8, ptr %10, align 8, !tbaa !9
  %11 = getelementptr inbounds %class.Individual, ptr %6, i32 0, i32 1
  %12 = load i8, ptr %11, align 8, !tbaa !14, !range !15, !noundef !16
  %13 = trunc i8 %12 to i1
  %14 = load ptr, ptr %4, align 8, !tbaa !5
  %15 = getelementptr inbounds %class.Individual, ptr %14, i32 0, i32 1
  %16 = zext i1 %13 to i8
  store i8 %16, ptr %15, align 8, !tbaa !14
  %17 = getelementptr inbounds %class.Individual, ptr %6, i32 0, i32 6
  %18 = load double, ptr %17, align 8, !tbaa !17
  %19 = load ptr, ptr %4, align 8, !tbaa !5
  %20 = getelementptr inbounds %class.Individual, ptr %19, i32 0, i32 6
  store double %18, ptr %20, align 8, !tbaa !17
  %21 = getelementptr inbounds %class.Individual, ptr %6, i32 0, i32 4
  %22 = load i32, ptr %21, align 8, !tbaa !18
  %23 = load ptr, ptr %4, align 8, !tbaa !5
  %24 = getelementptr inbounds %class.Individual, ptr %23, i32 0, i32 4
  store i32 %22, ptr %24, align 8, !tbaa !18
  %25 = load ptr, ptr %4, align 8, !tbaa !5
  %26 = getelementptr inbounds %class.Individual, ptr %25, i32 0, i32 8
  %27 = load i32, ptr %26, align 8, !tbaa !19
  %28 = getelementptr inbounds %class.Individual, ptr %6, i32 0, i32 8
  %29 = load i32, ptr %28, align 8, !tbaa !19
  %30 = icmp ne i32 %27, %29
  br i1 %30, label %31, label %57

31:                                               ; preds = %2
  %32 = load ptr, ptr %4, align 8, !tbaa !5
  %33 = getelementptr inbounds %class.Individual, ptr %32, i32 0, i32 7
  %34 = load ptr, ptr %33, align 8, !tbaa !20
  %35 = icmp eq ptr %34, null
  br i1 %35, label %37, label %36

36:                                               ; preds = %31
  call void @_ZdlPvm(ptr noundef %34, i64 noundef 8) #5
  br label %37

37:                                               ; preds = %36, %31
  %38 = getelementptr inbounds %class.Individual, ptr %6, i32 0, i32 8
  %39 = load i32, ptr %38, align 8, !tbaa !19
  %40 = icmp sgt i32 %39, 0
  br i1 %40, label %41, label %52

41:                                               ; preds = %37
  %42 = getelementptr inbounds %class.Individual, ptr %6, i32 0, i32 8
  %43 = load i32, ptr %42, align 8, !tbaa !19
  %44 = sext i32 %43 to i64
  %45 = call { i64, i1 } @llvm.umul.with.overflow.i64(i64 %44, i64 8)
  %46 = extractvalue { i64, i1 } %45, 1
  %47 = extractvalue { i64, i1 } %45, 0
  %48 = select i1 %46, i64 -1, i64 %47
  %49 = call noalias noundef nonnull ptr @_Znam(i64 noundef %48) #6
  %50 = load ptr, ptr %4, align 8, !tbaa !5
  %51 = getelementptr inbounds %class.Individual, ptr %50, i32 0, i32 7
  store ptr %49, ptr %51, align 8, !tbaa !20
  br label %52

52:                                               ; preds = %41, %37
  %53 = getelementptr inbounds %class.Individual, ptr %6, i32 0, i32 8
  %54 = load i32, ptr %53, align 8, !tbaa !19
  %55 = load ptr, ptr %4, align 8, !tbaa !5
  %56 = getelementptr inbounds %class.Individual, ptr %55, i32 0, i32 8
  store i32 %54, ptr %56, align 8, !tbaa !19
  br label %57

57:                                               ; preds = %52, %2
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #7
  store i32 0, ptr %5, align 4, !tbaa !21
  br label %58

58:                                               ; preds = %77, %57
  %59 = load i32, ptr %5, align 4, !tbaa !21
  %60 = getelementptr inbounds %class.Individual, ptr %6, i32 0, i32 8
  %61 = load i32, ptr %60, align 8, !tbaa !19
  %62 = icmp slt i32 %59, %61
  br i1 %62, label %64, label %63

63:                                               ; preds = %58
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #7
  br label %80

64:                                               ; preds = %58
  %65 = getelementptr inbounds %class.Individual, ptr %6, i32 0, i32 7
  %66 = load ptr, ptr %65, align 8, !tbaa !20
  %67 = load i32, ptr %5, align 4, !tbaa !21
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds double, ptr %66, i64 %68
  %70 = load double, ptr %69, align 8, !tbaa !22
  %71 = load ptr, ptr %4, align 8, !tbaa !5
  %72 = getelementptr inbounds %class.Individual, ptr %71, i32 0, i32 7
  %73 = load ptr, ptr %72, align 8, !tbaa !20
  %74 = load i32, ptr %5, align 4, !tbaa !21
  %75 = sext i32 %74 to i64
  %76 = getelementptr inbounds double, ptr %73, i64 %75
  store double %70, ptr %76, align 8, !tbaa !22
  br label %77

77:                                               ; preds = %64
  %78 = load i32, ptr %5, align 4, !tbaa !21
  %79 = add nsw i32 %78, 1
  store i32 %79, ptr %5, align 4, !tbaa !21
  br label %58, !llvm.loop !23

80:                                               ; preds = %63
  ret void
}

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

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

attributes #0 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #1 = { 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 #2 = { 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 #3 = { 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 #4 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { builtin nounwind }
attributes #6 = { builtin allocsize(0) }
attributes #7 = { 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, !12, i64 16}
!10 = !{!"_ZTS10Individual", !11, i64 8, !12, i64 16, !13, i64 24, !12, i64 32, !6, i64 40, !13, i64 48}
!11 = !{!"bool", !7, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = !{!"int", !7, i64 0}
!14 = !{!10, !11, i64 8}
!15 = !{i8 0, i8 2}
!16 = !{}
!17 = !{!10, !12, i64 32}
!18 = !{!10, !13, i64 24}
!19 = !{!10, !13, i64 48}
!20 = !{!10, !6, i64 40}
!21 = !{!13, !13, i64 0}
!22 = !{!12, !12, i64 0}
!23 = distinct !{!23, !24}
!24 = !{!"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: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znam(i64 noundef) local_unnamed_addr #0

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN10Individual4copyEPS_(ptr nocapture noundef nonnull readonly align 8 dereferenceable(52) %0, ptr nocapture noundef %1) unnamed_addr #2 align 2 {
  %3 = getelementptr inbounds i8, ptr %0, i64 16
  %4 = load double, ptr %3, align 8, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %1, i64 16
  store double %4, ptr %5, align 8, !tbaa !5
  %6 = getelementptr inbounds i8, ptr %0, i64 8
  %7 = load i8, ptr %6, align 8, !tbaa !13, !range !14, !noundef !15
  %8 = getelementptr inbounds i8, ptr %1, i64 8
  store i8 %7, ptr %8, align 8, !tbaa !13
  %9 = getelementptr inbounds i8, ptr %0, i64 32
  %10 = load double, ptr %9, align 8, !tbaa !16
  %11 = getelementptr inbounds i8, ptr %1, i64 32
  store double %10, ptr %11, align 8, !tbaa !16
  %12 = getelementptr inbounds i8, ptr %0, i64 24
  %13 = load i32, ptr %12, align 8, !tbaa !17
  %14 = getelementptr inbounds i8, ptr %1, i64 24
  store i32 %13, ptr %14, align 8, !tbaa !17
  %15 = getelementptr inbounds i8, ptr %1, i64 48
  %16 = load i32, ptr %15, align 8, !tbaa !18
  %17 = getelementptr inbounds i8, ptr %0, i64 48
  %18 = load i32, ptr %17, align 8, !tbaa !18
  %.not = icmp eq i32 %16, %18
  br i1 %.not, label %32, label %19

19:                                               ; preds = %2
  %20 = getelementptr inbounds i8, ptr %1, i64 40
  %21 = load ptr, ptr %20, align 8, !tbaa !19
  %22 = icmp eq ptr %21, null
  br i1 %22, label %24, label %23

23:                                               ; preds = %19
  tail call void @_ZdlPvm(ptr noundef nonnull %21, i64 noundef 8) #3
  %.pre = load i32, ptr %17, align 8, !tbaa !18
  br label %24

24:                                               ; preds = %23, %19
  %25 = phi i32 [ %.pre, %23 ], [ %18, %19 ]
  %26 = icmp sgt i32 %25, 0
  br i1 %26, label %27, label %31

27:                                               ; preds = %24
  %28 = zext nneg i32 %25 to i64
  %29 = shl nuw nsw i64 %28, 3
  %30 = tail call noalias noundef nonnull ptr @_Znam(i64 noundef %29) #4
  store ptr %30, ptr %20, align 8, !tbaa !19
  br label %31

31:                                               ; preds = %27, %24
  store i32 %25, ptr %15, align 8, !tbaa !18
  %.pre17 = load i32, ptr %17, align 8, !tbaa !18
  br label %32

32:                                               ; preds = %31, %2
  %33 = phi i32 [ %.pre17, %31 ], [ %16, %2 ]
  %34 = icmp sgt i32 %33, 0
  br i1 %34, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %32
  %35 = getelementptr inbounds i8, ptr %0, i64 40
  %36 = load ptr, ptr %35, align 8, !tbaa !19
  %37 = getelementptr inbounds i8, ptr %1, i64 40
  %38 = load ptr, ptr %37, align 8, !tbaa !19
  %wide.trip.count = zext nneg i32 %33 to i64
  %min.iters.check = icmp ult i32 %33, 6
  %39 = ptrtoint ptr %38 to i64
  %40 = ptrtoint ptr %36 to i64
  %41 = sub i64 %39, %40
  %diff.check = icmp ult i64 %41, 32
  %or.cond = select i1 %min.iters.check, i1 true, i1 %diff.check
  br i1 %or.cond, label %scalar.ph.preheader, label %vector.ph

scalar.ph.preheader:                              ; preds = %middle.block, %.lr.ph
  %indvars.iv.ph = phi i64 [ 0, %.lr.ph ], [ %n.vec, %middle.block ]
  %xtraiter = and i64 %wide.trip.count, 3
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %scalar.ph.prol.loopexit, label %scalar.ph.prol

scalar.ph.prol:                                   ; preds = %scalar.ph.preheader, %scalar.ph.prol
  %indvars.iv.prol = phi i64 [ %indvars.iv.next.prol, %scalar.ph.prol ], [ %indvars.iv.ph, %scalar.ph.preheader ]
  %prol.iter = phi i64 [ %prol.iter.next, %scalar.ph.prol ], [ 0, %scalar.ph.preheader ]
  %42 = getelementptr inbounds double, ptr %36, i64 %indvars.iv.prol
  %43 = load double, ptr %42, align 8, !tbaa !20
  %44 = getelementptr inbounds double, ptr %38, i64 %indvars.iv.prol
  store double %43, ptr %44, align 8, !tbaa !20
  %indvars.iv.next.prol = add nuw nsw i64 %indvars.iv.prol, 1
  %prol.iter.next = add i64 %prol.iter, 1
  %prol.iter.cmp.not = icmp eq i64 %prol.iter.next, %xtraiter
  br i1 %prol.iter.cmp.not, label %scalar.ph.prol.loopexit, label %scalar.ph.prol, !llvm.loop !21

scalar.ph.prol.loopexit:                          ; preds = %scalar.ph.prol, %scalar.ph.preheader
  %indvars.iv.unr = phi i64 [ %indvars.iv.ph, %scalar.ph.preheader ], [ %indvars.iv.next.prol, %scalar.ph.prol ]
  %45 = sub nsw i64 %indvars.iv.ph, %wide.trip.count
  %46 = icmp ugt i64 %45, -4
  br i1 %46, label %._crit_edge, label %scalar.ph

vector.ph:                                        ; preds = %.lr.ph
  %n.vec = and i64 %wide.trip.count, 2147483644
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %47 = getelementptr inbounds double, ptr %36, i64 %index
  %48 = getelementptr inbounds i8, ptr %47, i64 16
  %wide.load = load <2 x double>, ptr %47, align 8, !tbaa !20
  %wide.load18 = load <2 x double>, ptr %48, align 8, !tbaa !20
  %49 = getelementptr inbounds double, ptr %38, i64 %index
  %50 = getelementptr inbounds i8, ptr %49, i64 16
  store <2 x double> %wide.load, ptr %49, align 8, !tbaa !20
  store <2 x double> %wide.load18, ptr %50, align 8, !tbaa !20
  %index.next = add nuw i64 %index, 4
  %51 = icmp eq i64 %index.next, %n.vec
  br i1 %51, label %middle.block, label %vector.body, !llvm.loop !23

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %n.vec, %wide.trip.count
  br i1 %cmp.n, label %._crit_edge, label %scalar.ph.preheader

._crit_edge:                                      ; preds = %scalar.ph.prol.loopexit, %scalar.ph, %middle.block, %32
  ret void

scalar.ph:                                        ; preds = %scalar.ph.prol.loopexit, %scalar.ph
  %indvars.iv = phi i64 [ %indvars.iv.next.3, %scalar.ph ], [ %indvars.iv.unr, %scalar.ph.prol.loopexit ]
  %52 = getelementptr inbounds double, ptr %36, i64 %indvars.iv
  %53 = load double, ptr %52, align 8, !tbaa !20
  %54 = getelementptr inbounds double, ptr %38, i64 %indvars.iv
  store double %53, ptr %54, align 8, !tbaa !20
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %55 = getelementptr inbounds double, ptr %36, i64 %indvars.iv.next
  %56 = load double, ptr %55, align 8, !tbaa !20
  %57 = getelementptr inbounds double, ptr %38, i64 %indvars.iv.next
  store double %56, ptr %57, align 8, !tbaa !20
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
  %58 = getelementptr inbounds double, ptr %36, i64 %indvars.iv.next.1
  %59 = load double, ptr %58, align 8, !tbaa !20
  %60 = getelementptr inbounds double, ptr %38, i64 %indvars.iv.next.1
  store double %59, ptr %60, align 8, !tbaa !20
  %indvars.iv.next.2 = add nuw nsw i64 %indvars.iv, 3
  %61 = getelementptr inbounds double, ptr %36, i64 %indvars.iv.next.2
  %62 = load double, ptr %61, align 8, !tbaa !20
  %63 = getelementptr inbounds double, ptr %38, i64 %indvars.iv.next.2
  store double %62, ptr %63, align 8, !tbaa !20
  %indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
  %exitcond.not.3 = icmp eq i64 %indvars.iv.next.3, %wide.trip.count
  br i1 %exitcond.not.3, label %._crit_edge, label %scalar.ph, !llvm.loop !27
}

attributes #0 = { 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 #1 = { 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 #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 = { builtin nounwind }
attributes #4 = { builtin allocsize(0) }

!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 = !{!"_ZTS10Individual", !7, i64 8, !10, i64 16, !11, i64 24, !10, i64 32, !12, i64 40, !11, i64 48}
!7 = !{!"bool", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"double", !8, i64 0}
!11 = !{!"int", !8, i64 0}
!12 = !{!"any pointer", !8, i64 0}
!13 = !{!6, !7, i64 8}
!14 = !{i8 0, i8 2}
!15 = !{}
!16 = !{!6, !10, i64 32}
!17 = !{!6, !11, i64 24}
!18 = !{!6, !11, i64 48}
!19 = !{!6, !12, i64 40}
!20 = !{!10, !10, i64 0}
!21 = distinct !{!21, !22}
!22 = !{!"llvm.loop.unroll.disable"}
!23 = distinct !{!23, !24, !25, !26}
!24 = !{!"llvm.loop.mustprogress"}
!25 = !{!"llvm.loop.isvectorized", i32 1}
!26 = !{!"llvm.loop.unroll.runtime.disable"}
!27 = distinct !{!27, !24, !25}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopLoadEliminationPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,LoopVectorizePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass