; LLVM IR from ermig1979/Simd :: src/Simd/SimdBaseNeural.ll (ZN4Simd4Base19NeuralUpdateWeightsEPKfmS2_S2_PfS3_)

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

; 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: alwaysinline mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZN4Simd7AlignLoEmm(i64 noundef, i64 noundef) #1

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4Simd4Base19NeuralUpdateWeightsEPKfmS2_S2_PfS3_(ptr noundef %0, i64 noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4, ptr noundef %5) #2 {
  %7 = alloca ptr, align 8
  %8 = alloca i64, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca float, align 4
  %14 = alloca float, align 4
  %15 = alloca i64, align 8
  %16 = alloca i64, align 8
  store ptr %0, ptr %7, align 8, !tbaa !5
  store i64 %1, ptr %8, align 8, !tbaa !9
  store ptr %2, ptr %9, align 8, !tbaa !5
  store ptr %3, ptr %10, align 8, !tbaa !5
  store ptr %4, ptr %11, align 8, !tbaa !5
  store ptr %5, ptr %12, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #3
  %17 = load ptr, ptr %9, align 8, !tbaa !5
  %18 = getelementptr inbounds float, ptr %17, i64 0
  %19 = load float, ptr %18, align 4, !tbaa !11
  store float %19, ptr %13, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #3
  %20 = load ptr, ptr %10, align 8, !tbaa !5
  %21 = getelementptr inbounds float, ptr %20, i64 0
  %22 = load float, ptr %21, align 4, !tbaa !11
  store float %22, ptr %14, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #3
  %23 = load i64, ptr %8, align 8, !tbaa !9
  %24 = call noundef i64 @_ZN4Simd7AlignLoEmm(i64 noundef %23, i64 noundef 4)
  store i64 %24, ptr %15, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #3
  store i64 0, ptr %16, align 8, !tbaa !9
  br label %25

25:                                               ; preds = %58, %6
  %26 = load i64, ptr %16, align 8, !tbaa !9
  %27 = load i64, ptr %15, align 8, !tbaa !9
  %28 = icmp ult i64 %26, %27
  br i1 %28, label %29, label %61

29:                                               ; preds = %25
  %30 = load ptr, ptr %7, align 8, !tbaa !5
  %31 = load i64, ptr %16, align 8, !tbaa !9
  %32 = add i64 %31, 0
  %33 = load float, ptr %13, align 4, !tbaa !11
  %34 = load float, ptr %14, align 4, !tbaa !11
  %35 = load ptr, ptr %11, align 8, !tbaa !5
  %36 = load ptr, ptr %12, align 8, !tbaa !5
  call void @_ZN4Simd4Base13UpdateWeightsEPKfmffPfS3_(ptr noundef %30, i64 noundef %32, float noundef %33, float noundef %34, ptr noundef %35, ptr noundef %36)
  %37 = load ptr, ptr %7, align 8, !tbaa !5
  %38 = load i64, ptr %16, align 8, !tbaa !9
  %39 = add i64 %38, 1
  %40 = load float, ptr %13, align 4, !tbaa !11
  %41 = load float, ptr %14, align 4, !tbaa !11
  %42 = load ptr, ptr %11, align 8, !tbaa !5
  %43 = load ptr, ptr %12, align 8, !tbaa !5
  call void @_ZN4Simd4Base13UpdateWeightsEPKfmffPfS3_(ptr noundef %37, i64 noundef %39, float noundef %40, float noundef %41, ptr noundef %42, ptr noundef %43)
  %44 = load ptr, ptr %7, align 8, !tbaa !5
  %45 = load i64, ptr %16, align 8, !tbaa !9
  %46 = add i64 %45, 2
  %47 = load float, ptr %13, align 4, !tbaa !11
  %48 = load float, ptr %14, align 4, !tbaa !11
  %49 = load ptr, ptr %11, align 8, !tbaa !5
  %50 = load ptr, ptr %12, align 8, !tbaa !5
  call void @_ZN4Simd4Base13UpdateWeightsEPKfmffPfS3_(ptr noundef %44, i64 noundef %46, float noundef %47, float noundef %48, ptr noundef %49, ptr noundef %50)
  %51 = load ptr, ptr %7, align 8, !tbaa !5
  %52 = load i64, ptr %16, align 8, !tbaa !9
  %53 = add i64 %52, 3
  %54 = load float, ptr %13, align 4, !tbaa !11
  %55 = load float, ptr %14, align 4, !tbaa !11
  %56 = load ptr, ptr %11, align 8, !tbaa !5
  %57 = load ptr, ptr %12, align 8, !tbaa !5
  call void @_ZN4Simd4Base13UpdateWeightsEPKfmffPfS3_(ptr noundef %51, i64 noundef %53, float noundef %54, float noundef %55, ptr noundef %56, ptr noundef %57)
  br label %58

58:                                               ; preds = %29
  %59 = load i64, ptr %16, align 8, !tbaa !9
  %60 = add i64 %59, 4
  store i64 %60, ptr %16, align 8, !tbaa !9
  br label %25, !llvm.loop !13

61:                                               ; preds = %25
  br label %62

62:                                               ; preds = %73, %61
  %63 = load i64, ptr %16, align 8, !tbaa !9
  %64 = load i64, ptr %8, align 8, !tbaa !9
  %65 = icmp ult i64 %63, %64
  br i1 %65, label %66, label %76

66:                                               ; preds = %62
  %67 = load ptr, ptr %7, align 8, !tbaa !5
  %68 = load i64, ptr %16, align 8, !tbaa !9
  %69 = load float, ptr %13, align 4, !tbaa !11
  %70 = load float, ptr %14, align 4, !tbaa !11
  %71 = load ptr, ptr %11, align 8, !tbaa !5
  %72 = load ptr, ptr %12, align 8, !tbaa !5
  call void @_ZN4Simd4Base13UpdateWeightsEPKfmffPfS3_(ptr noundef %67, i64 noundef %68, float noundef %69, float noundef %70, ptr noundef %71, ptr noundef %72)
  br label %73

73:                                               ; preds = %66
  %74 = load i64, ptr %16, align 8, !tbaa !9
  %75 = add i64 %74, 1
  store i64 %75, ptr %16, align 8, !tbaa !9
  br label %62, !llvm.loop !15

76:                                               ; preds = %62
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #3
  ret void
}

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local void @_ZN4Simd4Base13UpdateWeightsEPKfmffPfS3_(ptr noundef, i64 noundef, float noundef, float noundef, ptr noundef, ptr noundef) #1

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { alwaysinline 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 = { 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 = !{!"float", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}


; 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: alwaysinline mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZN4Simd7AlignLoEmm(i64 noundef, i64 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN4Simd4Base19NeuralUpdateWeightsEPKfmS2_S2_PfS3_(ptr noundef %0, i64 noundef %1, ptr nocapture noundef readonly %2, ptr nocapture noundef readonly %3, ptr noundef %4, ptr noundef %5) local_unnamed_addr #1 {
  %7 = load float, ptr %2, align 4, !tbaa !5
  %8 = load float, ptr %3, align 4, !tbaa !5
  %9 = tail call noundef i64 @_ZN4Simd7AlignLoEmm(i64 noundef %1, i64 noundef 4)
  %.not = icmp eq i64 %9, 0
  br i1 %.not, label %.preheader, label %.lr.ph

.preheader:                                       ; preds = %.lr.ph, %6
  %.0.lcssa = phi i64 [ 0, %6 ], [ %14, %.lr.ph ]
  %10 = icmp ult i64 %.0.lcssa, %1
  br i1 %10, label %.lr.ph40, label %._crit_edge

.lr.ph:                                           ; preds = %6, %.lr.ph
  %.038 = phi i64 [ %14, %.lr.ph ], [ 0, %6 ]
  tail call void @_ZN4Simd4Base13UpdateWeightsEPKfmffPfS3_(ptr noundef %0, i64 noundef %.038, float noundef %7, float noundef %8, ptr noundef %4, ptr noundef %5)
  %11 = or disjoint i64 %.038, 1
  tail call void @_ZN4Simd4Base13UpdateWeightsEPKfmffPfS3_(ptr noundef %0, i64 noundef %11, float noundef %7, float noundef %8, ptr noundef %4, ptr noundef %5)
  %12 = or disjoint i64 %.038, 2
  tail call void @_ZN4Simd4Base13UpdateWeightsEPKfmffPfS3_(ptr noundef %0, i64 noundef %12, float noundef %7, float noundef %8, ptr noundef %4, ptr noundef %5)
  %13 = or disjoint i64 %.038, 3
  tail call void @_ZN4Simd4Base13UpdateWeightsEPKfmffPfS3_(ptr noundef %0, i64 noundef %13, float noundef %7, float noundef %8, ptr noundef %4, ptr noundef %5)
  %14 = add i64 %.038, 4
  %15 = icmp ult i64 %14, %9
  br i1 %15, label %.lr.ph, label %.preheader, !llvm.loop !9

.lr.ph40:                                         ; preds = %.preheader, %.lr.ph40
  %.139 = phi i64 [ %16, %.lr.ph40 ], [ %.0.lcssa, %.preheader ]
  tail call void @_ZN4Simd4Base13UpdateWeightsEPKfmffPfS3_(ptr noundef %0, i64 noundef %.139, float noundef %7, float noundef %8, ptr noundef %4, ptr noundef %5)
  %16 = add i64 %.139, 1
  %exitcond.not = icmp eq i64 %16, %1
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph40, !llvm.loop !11

._crit_edge:                                      ; preds = %.lr.ph40, %.preheader
  ret void
}

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local void @_ZN4Simd4Base13UpdateWeightsEPKfmffPfS3_(ptr noundef, i64 noundef, float noundef, float noundef, ptr noundef, ptr noundef) local_unnamed_addr #0

attributes #0 = { alwaysinline 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 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" }

!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 = !{!"float", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}


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