; LLVM IR from TheAlgorithms/C-Plus-Plus :: machine_learning (kohonen_som_trace)

; 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.std::_Expr" = type { %"struct.std::__detail::_BinClos" }
%"struct.std::__detail::_BinClos" = type { %"class.std::__detail::_BinBase" }
%"class.std::__detail::_BinBase" = type { %"struct.std::__detail::_BinClos.0", %"struct.std::__detail::_BinClos.0" }
%"struct.std::__detail::_BinClos.0" = type { %"class.std::__detail::_BinBase.1" }
%"class.std::__detail::_BinBase.1" = type { ptr, ptr }
%"class.std::_Expr.2" = type { %"struct.std::__detail::_BinClos.0" }
%"class.std::_Expr.3" = type { %"struct.std::__detail::_BinClos.4" }
%"struct.std::__detail::_BinClos.4" = type { %"class.std::__detail::_BinBase1" }
%"class.std::__detail::_BinBase1" = type { double, %"struct.std::__detail::_BinClos.0" }

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN16machine_learning14update_weightsERKSt8valarrayIdEPSt6vectorIS1_SaIS1_EEPS1_di(ptr noundef nonnull align 8 dereferenceable(16) %0, ptr noundef %1, ptr noundef %2, double noundef %3, i32 noundef %4) #2 {
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca double, align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca %"class.std::_Expr", align 8
  %15 = alloca %"class.std::_Expr.2", align 8
  %16 = alloca %"class.std::_Expr.2", align 8
  %17 = alloca ptr, align 8
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  %21 = alloca i32, align 4
  %22 = alloca i32, align 4
  %23 = alloca i32, align 4
  %24 = alloca %"class.std::_Expr.3", align 8
  %25 = alloca %"class.std::_Expr.2", align 8
  store ptr %0, ptr %6, align 8, !tbaa !5
  store ptr %1, ptr %7, align 8, !tbaa !5
  store ptr %2, ptr %8, align 8, !tbaa !5
  store double %3, ptr %9, align 8, !tbaa !9
  store i32 %4, ptr %10, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  store i32 0, ptr %11, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  store i32 0, ptr %12, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #5
  %26 = load ptr, ptr %7, align 8, !tbaa !5
  %27 = call noundef i64 @_ZNKSt6vectorISt8valarrayIdESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %26) #5
  %28 = trunc i64 %27 to i32
  store i32 %28, ptr %13, align 4, !tbaa !11
  store i32 0, ptr %11, align 4, !tbaa !11
  br label %29

29:                                               ; preds = %63, %5
  %30 = load i32, ptr %11, align 4, !tbaa !11
  %31 = load i32, ptr %13, align 4, !tbaa !11
  %32 = icmp slt i32 %30, %31
  br i1 %32, label %33, label %66

33:                                               ; preds = %29
  call void @llvm.lifetime.start.p0(i64 32, ptr %14) #5
  call void @llvm.lifetime.start.p0(i64 16, ptr %15) #5
  %34 = load ptr, ptr %7, align 8, !tbaa !5
  %35 = load i32, ptr %11, align 4, !tbaa !11
  %36 = sext i32 %35 to i64
  %37 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorISt8valarrayIdESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %34, i64 noundef %36) #5
  %38 = load ptr, ptr %6, align 8, !tbaa !5
  %39 = call { ptr, ptr } @_ZStmiIdESt5_ExprINSt8__detail8_BinClosISt7__minusSt9_ValArrayS4_T_S5_EENSt5__funIS3_S5_E11result_typeEERKSt8valarrayIS5_ESE_(ptr noundef nonnull align 8 dereferenceable(16) %37, ptr noundef nonnull align 8 dereferenceable(16) %38)
  %40 = getelementptr inbounds %"class.std::_Expr.2", ptr %15, i32 0, i32 0
  %41 = getelementptr inbounds %"struct.std::__detail::_BinClos.0", ptr %40, i32 0, i32 0
  %42 = getelementptr inbounds { ptr, ptr }, ptr %41, i32 0, i32 0
  %43 = extractvalue { ptr, ptr } %39, 0
  store ptr %43, ptr %42, align 8
  %44 = getelementptr inbounds { ptr, ptr }, ptr %41, i32 0, i32 1
  %45 = extractvalue { ptr, ptr } %39, 1
  store ptr %45, ptr %44, align 8
  call void @llvm.lifetime.start.p0(i64 16, ptr %16) #5
  %46 = load ptr, ptr %7, align 8, !tbaa !5
  %47 = load i32, ptr %11, align 4, !tbaa !11
  %48 = sext i32 %47 to i64
  %49 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorISt8valarrayIdESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %46, i64 noundef %48) #5
  %50 = load ptr, ptr %6, align 8, !tbaa !5
  %51 = call { ptr, ptr } @_ZStmiIdESt5_ExprINSt8__detail8_BinClosISt7__minusSt9_ValArrayS4_T_S5_EENSt5__funIS3_S5_E11result_typeEERKSt8valarrayIS5_ESE_(ptr noundef nonnull align 8 dereferenceable(16) %49, ptr noundef nonnull align 8 dereferenceable(16) %50)
  %52 = getelementptr inbounds %"class.std::_Expr.2", ptr %16, i32 0, i32 0
  %53 = getelementptr inbounds %"struct.std::__detail::_BinClos.0", ptr %52, i32 0, i32 0
  %54 = getelementptr inbounds { ptr, ptr }, ptr %53, i32 0, i32 0
  %55 = extractvalue { ptr, ptr } %51, 0
  store ptr %55, ptr %54, align 8
  %56 = getelementptr inbounds { ptr, ptr }, ptr %53, i32 0, i32 1
  %57 = extractvalue { ptr, ptr } %51, 1
  store ptr %57, ptr %56, align 8
  call void @_ZStmlINSt8__detail8_BinClosISt7__minusSt9_ValArrayS3_ddEES4_ESt5_ExprINS1_ISt12__multipliesS5_S5_T_T0_EENSt5__funIS6_NS7_10value_typeEE11result_typeEERKS5_IS7_SB_ERKS5_IS8_NS8_10value_typeEE(ptr dead_on_unwind writable sret(%"class.std::_Expr") align 8 %14, ptr noundef nonnull align 8 dereferenceable(16) %15, ptr noundef nonnull align 8 dereferenceable(16) %16)
  %58 = call noundef double @_ZNKSt5_ExprINSt8__detail8_BinClosISt12__multipliesS_S_NS1_ISt7__minusSt9_ValArrayS4_ddEES5_EEdE3sumEv(ptr noundef nonnull align 8 dereferenceable(32) %14)
  %59 = load ptr, ptr %8, align 8, !tbaa !5
  %60 = load i32, ptr %11, align 4, !tbaa !11
  %61 = sext i32 %60 to i64
  %62 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt8valarrayIdEixEm(ptr noundef nonnull align 8 dereferenceable(16) %59, i64 noundef %61) #5
  store double %58, ptr %62, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 16, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr %14) #5
  br label %63

63:                                               ; preds = %33
  %64 = load i32, ptr %11, align 4, !tbaa !11
  %65 = add nsw i32 %64, 1
  store i32 %65, ptr %11, align 4, !tbaa !11
  br label %29, !llvm.loop !13

66:                                               ; preds = %29
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #5
  %67 = load ptr, ptr %8, align 8, !tbaa !5
  %68 = call noundef ptr @_ZSt5beginIdEPT_RSt8valarrayIS0_E(ptr noundef nonnull align 8 dereferenceable(16) %67) #5
  %69 = load ptr, ptr %8, align 8, !tbaa !5
  %70 = call noundef ptr @_ZSt3endIdEPT_RSt8valarrayIS0_E(ptr noundef nonnull align 8 dereferenceable(16) %69) #5
  %71 = call noundef ptr @_ZSt11min_elementIPdET_S1_S1_(ptr noundef %68, ptr noundef %70)
  store ptr %71, ptr %17, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #5
  %72 = load ptr, ptr %8, align 8, !tbaa !5
  %73 = call noundef ptr @_ZSt5beginIdEPT_RSt8valarrayIS0_E(ptr noundef nonnull align 8 dereferenceable(16) %72) #5
  %74 = load ptr, ptr %17, align 8, !tbaa !5
  %75 = call noundef i64 @_ZSt8distanceIPdENSt15iterator_traitsIT_E15difference_typeES2_S2_(ptr noundef %73, ptr noundef %74)
  %76 = trunc i64 %75 to i32
  store i32 %76, ptr %18, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #5
  store i32 0, ptr %20, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #5
  %77 = load i32, ptr %18, align 4, !tbaa !11
  %78 = load i32, ptr %10, align 4, !tbaa !11
  %79 = sub nsw i32 %77, %78
  store i32 %79, ptr %21, align 4, !tbaa !11
  %80 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %20, ptr noundef nonnull align 4 dereferenceable(4) %21)
  %81 = load i32, ptr %80, align 4, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #5
  store i32 %81, ptr %19, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #5
  %82 = load i32, ptr %18, align 4, !tbaa !11
  %83 = load i32, ptr %10, align 4, !tbaa !11
  %84 = add nsw i32 %82, %83
  %85 = add nsw i32 %84, 1
  store i32 %85, ptr %23, align 4, !tbaa !11
  %86 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %13, ptr noundef nonnull align 4 dereferenceable(4) %23)
  %87 = load i32, ptr %86, align 4, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #5
  store i32 %87, ptr %22, align 4, !tbaa !11
  %88 = load i32, ptr %19, align 4, !tbaa !11
  store i32 %88, ptr %11, align 4, !tbaa !11
  br label %89

89:                                               ; preds = %111, %66
  %90 = load i32, ptr %11, align 4, !tbaa !11
  %91 = load i32, ptr %22, align 4, !tbaa !11
  %92 = icmp slt i32 %90, %91
  br i1 %92, label %93, label %114

93:                                               ; preds = %89
  call void @llvm.lifetime.start.p0(i64 24, ptr %24) #5
  call void @llvm.lifetime.start.p0(i64 16, ptr %25) #5
  %94 = load ptr, ptr %6, align 8, !tbaa !5
  %95 = load ptr, ptr %7, align 8, !tbaa !5
  %96 = load i32, ptr %11, align 4, !tbaa !11
  %97 = sext i32 %96 to i64
  %98 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorISt8valarrayIdESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %95, i64 noundef %97) #5
  %99 = call { ptr, ptr } @_ZStmiIdESt5_ExprINSt8__detail8_BinClosISt7__minusSt9_ValArrayS4_T_S5_EENSt5__funIS3_S5_E11result_typeEERKSt8valarrayIS5_ESE_(ptr noundef nonnull align 8 dereferenceable(16) %94, ptr noundef nonnull align 8 dereferenceable(16) %98)
  %100 = getelementptr inbounds %"class.std::_Expr.2", ptr %25, i32 0, i32 0
  %101 = getelementptr inbounds %"struct.std::__detail::_BinClos.0", ptr %100, i32 0, i32 0
  %102 = getelementptr inbounds { ptr, ptr }, ptr %101, i32 0, i32 0
  %103 = extractvalue { ptr, ptr } %99, 0
  store ptr %103, ptr %102, align 8
  %104 = getelementptr inbounds { ptr, ptr }, ptr %101, i32 0, i32 1
  %105 = extractvalue { ptr, ptr } %99, 1
  store ptr %105, ptr %104, align 8
  call void @_ZStmlINSt8__detail8_BinClosISt7__minusSt9_ValArrayS3_ddEEESt5_ExprINS1_ISt12__multipliesSt9_ConstantS5_NT_10value_typeES8_EENSt5__funIS6_S9_E11result_typeEERKS9_RKS5_IS8_S9_E(ptr dead_on_unwind writable sret(%"class.std::_Expr.3") align 8 %24, ptr noundef nonnull align 8 dereferenceable(8) %9, ptr noundef nonnull align 8 dereferenceable(16) %25)
  %106 = load ptr, ptr %7, align 8, !tbaa !5
  %107 = load i32, ptr %11, align 4, !tbaa !11
  %108 = sext i32 %107 to i64
  %109 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorISt8valarrayIdESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %106, i64 noundef %108) #5
  %110 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt8valarrayIdEpLINSt8__detail8_BinClosISt12__multipliesSt9_ConstantSt5_ExprdNS3_ISt7__minusSt9_ValArrayS8_ddEEEEEERS0_RKS6_IT_dE(ptr noundef nonnull align 8 dereferenceable(16) %109, ptr noundef nonnull align 8 dereferenceable(24) %24)
  call void @llvm.lifetime.end.p0(i64 16, ptr %25) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr %24) #5
  br label %111

111:                                              ; preds = %93
  %112 = load i32, ptr %11, align 4, !tbaa !11
  %113 = add nsw i32 %112, 1
  store i32 %113, ptr %11, align 4, !tbaa !11
  br label %89, !llvm.loop !15

114:                                              ; preds = %89
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  ret void
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZStmlINSt8__detail8_BinClosISt7__minusSt9_ValArrayS3_ddEES4_ESt5_ExprINS1_ISt12__multipliesS5_S5_T_T0_EENSt5__funIS6_NS7_10value_typeEE11result_typeEERKS5_IS7_SB_ERKS5_IS8_NS8_10value_typeEE(ptr dead_on_unwind noalias writable sret(%"class.std::_Expr") align 8, ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) #3

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local { ptr, ptr } @_ZStmiIdESt5_ExprINSt8__detail8_BinClosISt7__minusSt9_ValArrayS4_T_S5_EENSt5__funIS3_S5_E11result_typeEERKSt8valarrayIS5_ESE_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) #3

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef double @_ZNKSt5_ExprINSt8__detail8_BinClosISt12__multipliesS_S_NS1_ISt7__minusSt9_ValArrayS4_ddEES5_EEdE3sumEv(ptr noundef nonnull align 8 dereferenceable(32)) #3 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt8valarrayIdEixEm(ptr noundef nonnull align 8 dereferenceable(16), i64 noundef) #4 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef ptr @_ZSt11min_elementIPdET_S1_S1_(ptr noundef, ptr noundef) #3

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZSt5beginIdEPT_RSt8valarrayIS0_E(ptr noundef nonnull align 8 dereferenceable(16)) #4

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZSt3endIdEPT_RSt8valarrayIS0_E(ptr noundef nonnull align 8 dereferenceable(16)) #4

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i64 @_ZSt8distanceIPdENSt15iterator_traitsIT_E15difference_typeES2_S2_(ptr noundef, ptr noundef) #3

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #4

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #4

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZStmlINSt8__detail8_BinClosISt7__minusSt9_ValArrayS3_ddEEESt5_ExprINS1_ISt12__multipliesSt9_ConstantS5_NT_10value_typeES8_EENSt5__funIS6_S9_E11result_typeEERKS9_RKS5_IS8_S9_E(ptr dead_on_unwind noalias writable sret(%"class.std::_Expr.3") align 8, ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(16)) #3

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt8valarrayIdEpLINSt8__detail8_BinClosISt12__multipliesSt9_ConstantSt5_ExprdNS3_ISt7__minusSt9_ValArrayS8_ddEEEEEERS0_RKS6_IT_dE(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(24)) #3 align 2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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" }
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 = { inlinehint 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 = { inlinehint 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 #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 = !{!"double", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !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"

%"class.std::_Expr" = type { %"struct.std::__detail::_BinClos" }
%"struct.std::__detail::_BinClos" = type { %"class.std::__detail::_BinBase" }
%"class.std::__detail::_BinBase" = type { %"struct.std::__detail::_BinClos.0", %"struct.std::__detail::_BinClos.0" }
%"struct.std::__detail::_BinClos.0" = type { %"class.std::__detail::_BinBase.1" }
%"class.std::__detail::_BinBase.1" = type { ptr, ptr }
%"class.std::_Expr.2" = type { %"struct.std::__detail::_BinClos.0" }
%"class.std::_Expr.3" = type { %"struct.std::__detail::_BinClos.4" }
%"struct.std::__detail::_BinClos.4" = type { %"class.std::__detail::_BinBase1" }
%"class.std::__detail::_BinBase1" = type { double, %"struct.std::__detail::_BinClos.0" }

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN16machine_learning14update_weightsERKSt8valarrayIdEPSt6vectorIS1_SaIS1_EEPS1_di(ptr noundef nonnull align 8 dereferenceable(16) %0, ptr noundef nonnull %1, ptr noundef %2, double noundef %3, i32 noundef %4) local_unnamed_addr #2 {
  %6 = alloca double, align 8
  %7 = alloca i32, align 4
  %8 = alloca %"class.std::_Expr", align 8
  %9 = alloca %"class.std::_Expr.2", align 8
  %10 = alloca %"class.std::_Expr.2", align 8
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca %"class.std::_Expr.3", align 8
  %15 = alloca %"class.std::_Expr.2", align 8
  store double %3, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #5
  %16 = tail call noundef i64 @_ZNKSt6vectorISt8valarrayIdESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %1) #5
  %17 = trunc i64 %16 to i32
  store i32 %17, ptr %7, align 4, !tbaa !9
  %18 = icmp sgt i32 %17, 0
  br i1 %18, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %5
  %19 = getelementptr inbounds i8, ptr %9, i64 8
  %20 = getelementptr inbounds i8, ptr %10, i64 8
  %21 = and i64 %16, 2147483647
  br label %22

22:                                               ; preds = %.lr.ph, %22
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %22 ]
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %8) #5
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %9) #5
  %23 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorISt8valarrayIdESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %indvars.iv) #5
  %24 = call { ptr, ptr } @_ZStmiIdESt5_ExprINSt8__detail8_BinClosISt7__minusSt9_ValArrayS4_T_S5_EENSt5__funIS3_S5_E11result_typeEERKSt8valarrayIS5_ESE_(ptr noundef nonnull align 8 dereferenceable(16) %23, ptr noundef nonnull align 8 dereferenceable(16) %0)
  %25 = extractvalue { ptr, ptr } %24, 0
  store ptr %25, ptr %9, align 8
  %26 = extractvalue { ptr, ptr } %24, 1
  store ptr %26, ptr %19, align 8
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %10) #5
  %27 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorISt8valarrayIdESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %indvars.iv) #5
  %28 = call { ptr, ptr } @_ZStmiIdESt5_ExprINSt8__detail8_BinClosISt7__minusSt9_ValArrayS4_T_S5_EENSt5__funIS3_S5_E11result_typeEERKSt8valarrayIS5_ESE_(ptr noundef nonnull align 8 dereferenceable(16) %27, ptr noundef nonnull align 8 dereferenceable(16) %0)
  %29 = extractvalue { ptr, ptr } %28, 0
  store ptr %29, ptr %10, align 8
  %30 = extractvalue { ptr, ptr } %28, 1
  store ptr %30, ptr %20, align 8
  call void @_ZStmlINSt8__detail8_BinClosISt7__minusSt9_ValArrayS3_ddEES4_ESt5_ExprINS1_ISt12__multipliesS5_S5_T_T0_EENSt5__funIS6_NS7_10value_typeEE11result_typeEERKS5_IS7_SB_ERKS5_IS8_NS8_10value_typeEE(ptr dead_on_unwind nonnull writable sret(%"class.std::_Expr") align 8 %8, ptr noundef nonnull align 8 dereferenceable(16) %9, ptr noundef nonnull align 8 dereferenceable(16) %10)
  %31 = call noundef double @_ZNKSt5_ExprINSt8__detail8_BinClosISt12__multipliesS_S_NS1_ISt7__minusSt9_ValArrayS4_ddEES5_EEdE3sumEv(ptr noundef nonnull align 8 dereferenceable(32) %8)
  %32 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt8valarrayIdEixEm(ptr noundef nonnull align 8 dereferenceable(16) %2, i64 noundef %indvars.iv) #5
  store double %31, ptr %32, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %10) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %9) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %8) #5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %33 = icmp ult i64 %indvars.iv.next, %21
  br i1 %33, label %22, label %._crit_edge, !llvm.loop !11

._crit_edge:                                      ; preds = %22, %5
  %34 = call noundef ptr @_ZSt5beginIdEPT_RSt8valarrayIS0_E(ptr noundef nonnull align 8 dereferenceable(16) %2) #5
  %35 = call noundef ptr @_ZSt3endIdEPT_RSt8valarrayIS0_E(ptr noundef nonnull align 8 dereferenceable(16) %2) #5
  %36 = call noundef ptr @_ZSt11min_elementIPdET_S1_S1_(ptr noundef %34, ptr noundef %35)
  %37 = call noundef ptr @_ZSt5beginIdEPT_RSt8valarrayIS0_E(ptr noundef nonnull align 8 dereferenceable(16) %2) #5
  %38 = call noundef i64 @_ZSt8distanceIPdENSt15iterator_traitsIT_E15difference_typeES2_S2_(ptr noundef %37, ptr noundef %36)
  %39 = trunc i64 %38 to i32
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %11) #5
  store i32 0, ptr %11, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %12) #5
  %40 = sub nsw i32 %39, %4
  store i32 %40, ptr %12, align 4, !tbaa !9
  %41 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %11, ptr noundef nonnull align 4 dereferenceable(4) %12)
  %42 = load i32, ptr %41, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %12) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %11) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %13) #5
  %43 = add i32 %4, 1
  %44 = add i32 %43, %39
  store i32 %44, ptr %13, align 4, !tbaa !9
  %45 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %7, ptr noundef nonnull align 4 dereferenceable(4) %13)
  %46 = load i32, ptr %45, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %13) #5
  %47 = icmp slt i32 %42, %46
  br i1 %47, label %.lr.ph30, label %._crit_edge31

.lr.ph30:                                         ; preds = %._crit_edge
  %48 = getelementptr inbounds i8, ptr %15, i64 8
  %49 = sext i32 %42 to i64
  br label %50

50:                                               ; preds = %.lr.ph30, %50
  %indvars.iv33 = phi i64 [ %49, %.lr.ph30 ], [ %indvars.iv.next34, %50 ]
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %14) #5
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %15) #5
  %51 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorISt8valarrayIdESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %indvars.iv33) #5
  %52 = call { ptr, ptr } @_ZStmiIdESt5_ExprINSt8__detail8_BinClosISt7__minusSt9_ValArrayS4_T_S5_EENSt5__funIS3_S5_E11result_typeEERKSt8valarrayIS5_ESE_(ptr noundef nonnull align 8 dereferenceable(16) %0, ptr noundef nonnull align 8 dereferenceable(16) %51)
  %53 = extractvalue { ptr, ptr } %52, 0
  store ptr %53, ptr %15, align 8
  %54 = extractvalue { ptr, ptr } %52, 1
  store ptr %54, ptr %48, align 8
  call void @_ZStmlINSt8__detail8_BinClosISt7__minusSt9_ValArrayS3_ddEEESt5_ExprINS1_ISt12__multipliesSt9_ConstantS5_NT_10value_typeES8_EENSt5__funIS6_S9_E11result_typeEERKS9_RKS5_IS8_S9_E(ptr dead_on_unwind nonnull writable sret(%"class.std::_Expr.3") align 8 %14, ptr noundef nonnull align 8 dereferenceable(8) %6, ptr noundef nonnull align 8 dereferenceable(16) %15)
  %55 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorISt8valarrayIdESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %indvars.iv33) #5
  %56 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt8valarrayIdEpLINSt8__detail8_BinClosISt12__multipliesSt9_ConstantSt5_ExprdNS3_ISt7__minusSt9_ValArrayS8_ddEEEEEERS0_RKS6_IT_dE(ptr noundef nonnull align 8 dereferenceable(16) %55, ptr noundef nonnull align 8 dereferenceable(24) %14)
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %15) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %14) #5
  %indvars.iv.next34 = add nsw i64 %indvars.iv33, 1
  %lftr.wideiv = trunc i64 %indvars.iv.next34 to i32
  %exitcond.not = icmp eq i32 %46, %lftr.wideiv
  br i1 %exitcond.not, label %._crit_edge31, label %50, !llvm.loop !13

._crit_edge31:                                    ; preds = %50, %._crit_edge
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #5
  ret void
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZStmlINSt8__detail8_BinClosISt7__minusSt9_ValArrayS3_ddEES4_ESt5_ExprINS1_ISt12__multipliesS5_S5_T_T0_EENSt5__funIS6_NS7_10value_typeEE11result_typeEERKS5_IS7_SB_ERKS5_IS8_NS8_10value_typeEE(ptr dead_on_unwind noalias writable sret(%"class.std::_Expr") align 8, ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #3

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local { ptr, ptr } @_ZStmiIdESt5_ExprINSt8__detail8_BinClosISt7__minusSt9_ValArrayS4_T_S5_EENSt5__funIS3_S5_E11result_typeEERKSt8valarrayIS5_ESE_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #3

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef double @_ZNKSt5_ExprINSt8__detail8_BinClosISt12__multipliesS_S_NS1_ISt7__minusSt9_ValArrayS4_ddEES5_EEdE3sumEv(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt8valarrayIdEixEm(ptr noundef nonnull align 8 dereferenceable(16), i64 noundef) local_unnamed_addr #4 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef ptr @_ZSt11min_elementIPdET_S1_S1_(ptr noundef, ptr noundef) local_unnamed_addr #3

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZSt5beginIdEPT_RSt8valarrayIS0_E(ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #4

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZSt3endIdEPT_RSt8valarrayIS0_E(ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #4

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i64 @_ZSt8distanceIPdENSt15iterator_traitsIT_E15difference_typeES2_S2_(ptr noundef, ptr noundef) local_unnamed_addr #3

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #4

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #4

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZStmlINSt8__detail8_BinClosISt7__minusSt9_ValArrayS3_ddEEESt5_ExprINS1_ISt12__multipliesSt9_ConstantS5_NT_10value_typeES8_EENSt5__funIS6_S9_E11result_typeEERKS9_RKS5_IS8_S9_E(ptr dead_on_unwind noalias writable sret(%"class.std::_Expr.3") align 8, ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #3

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt8valarrayIdEpLINSt8__detail8_BinClosISt12__multipliesSt9_ConstantSt5_ExprdNS3_ISt7__minusSt9_ValArrayS8_ddEEEEEERS0_RKS6_IT_dE(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #3 align 2

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


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