; LLVM IR from ermig1979/Simd :: src/Simd (SimdBaseSynetInnerProduct16bGemmNN)

; 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.Simd::Base::SynetInnerProduct16bGemmNN" = type { %"class.Simd::SynetInnerProduct16b", %"struct.Simd::Base::SynetInnerProduct16bGemmNN::AlgParam", ptr, ptr, ptr }
%"class.Simd::SynetInnerProduct16b" = type { %"struct.Simd::Deletable", %"struct.Simd::InnerProductParam16b", %"struct.Simd::Array", %"struct.Simd::Array.0", %"struct.Simd::Array.1", %"class.std::__cxx11::basic_string", i64, i64, i64 }
%"struct.Simd::Deletable" = type { ptr }
%"struct.Simd::InnerProductParam16b" = type { i64, i64, i64, i32, i32, i32, i32, i32, i32 }
%"struct.Simd::Array" = type { ptr, i64 }
%"struct.Simd::Array.0" = type { ptr, i64 }
%"struct.Simd::Array.1" = type { ptr, i64 }
%"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] }
%"struct.Simd::Base::SynetInnerProduct16bGemmNN::AlgParam" = type { i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64 }

@_ZTVN4Simd4Base26SynetInnerProduct16bGemmNNE = external dso_local unnamed_addr constant { [10 x ptr] }, align 8

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4Simd4Base26SynetInnerProduct16bGemmNNC2ERKNS_20InnerProductParam16bE(ptr noundef nonnull align 8 dereferenceable(304) %0, ptr noundef nonnull align 8 dereferenceable(48) %1) unnamed_addr #0 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %5 = load ptr, ptr %3, align 8
  %6 = load ptr, ptr %4, align 8, !tbaa !5
  call void @_ZN4Simd20SynetInnerProduct16bC2ERKNS_20InnerProductParam16bE(ptr noundef nonnull align 8 dereferenceable(160) %5, ptr noundef nonnull align 8 dereferenceable(48) %6)
  store ptr getelementptr inbounds inrange(-16, 64) ({ [10 x ptr] }, ptr @_ZTVN4Simd4Base26SynetInnerProduct16bGemmNNE, i32 0, i32 0, i32 2), ptr %5, align 8, !tbaa !9
  %7 = getelementptr inbounds %"class.Simd::Base::SynetInnerProduct16bGemmNN", ptr %5, i32 0, i32 1
  call void @llvm.memset.p0.i64(ptr align 8 %7, i8 0, i64 120, i1 false)
  %8 = getelementptr inbounds %"struct.Simd::Base::SynetInnerProduct16bGemmNN::AlgParam", ptr %7, i32 0, i32 0
  %9 = getelementptr inbounds %"struct.Simd::Base::SynetInnerProduct16bGemmNN::AlgParam", ptr %7, i32 0, i32 1
  %10 = getelementptr inbounds %"struct.Simd::Base::SynetInnerProduct16bGemmNN::AlgParam", ptr %7, i32 0, i32 2
  %11 = getelementptr inbounds %"struct.Simd::Base::SynetInnerProduct16bGemmNN::AlgParam", ptr %7, i32 0, i32 3
  %12 = getelementptr inbounds %"struct.Simd::Base::SynetInnerProduct16bGemmNN::AlgParam", ptr %7, i32 0, i32 4
  %13 = getelementptr inbounds %"struct.Simd::Base::SynetInnerProduct16bGemmNN::AlgParam", ptr %7, i32 0, i32 5
  %14 = getelementptr inbounds %"struct.Simd::Base::SynetInnerProduct16bGemmNN::AlgParam", ptr %7, i32 0, i32 6
  %15 = getelementptr inbounds %"struct.Simd::Base::SynetInnerProduct16bGemmNN::AlgParam", ptr %7, i32 0, i32 7
  %16 = getelementptr inbounds %"struct.Simd::Base::SynetInnerProduct16bGemmNN::AlgParam", ptr %7, i32 0, i32 8
  %17 = getelementptr inbounds %"struct.Simd::Base::SynetInnerProduct16bGemmNN::AlgParam", ptr %7, i32 0, i32 9
  %18 = getelementptr inbounds %"struct.Simd::Base::SynetInnerProduct16bGemmNN::AlgParam", ptr %7, i32 0, i32 10
  %19 = getelementptr inbounds %"struct.Simd::Base::SynetInnerProduct16bGemmNN::AlgParam", ptr %7, i32 0, i32 11
  %20 = getelementptr inbounds %"struct.Simd::Base::SynetInnerProduct16bGemmNN::AlgParam", ptr %7, i32 0, i32 12
  %21 = getelementptr inbounds %"struct.Simd::Base::SynetInnerProduct16bGemmNN::AlgParam", ptr %7, i32 0, i32 13
  %22 = getelementptr inbounds %"struct.Simd::Base::SynetInnerProduct16bGemmNN::AlgParam", ptr %7, i32 0, i32 14
  %23 = getelementptr inbounds %"class.Simd::Base::SynetInnerProduct16bGemmNN", ptr %5, i32 0, i32 2
  store ptr null, ptr %23, align 8, !tbaa !11
  %24 = getelementptr inbounds %"class.Simd::Base::SynetInnerProduct16bGemmNN", ptr %5, i32 0, i32 3
  store ptr null, ptr %24, align 8, !tbaa !25
  %25 = getelementptr inbounds %"class.Simd::Base::SynetInnerProduct16bGemmNN", ptr %5, i32 0, i32 4
  store ptr null, ptr %25, align 8, !tbaa !26
  %26 = load ptr, ptr %4, align 8, !tbaa !5
  %27 = getelementptr inbounds %"struct.Simd::InnerProductParam16b", ptr %26, i32 0, i32 4
  %28 = load i32, ptr %27, align 4, !tbaa !27
  %29 = icmp eq i32 %28, 0
  br i1 %29, label %35, label %30

30:                                               ; preds = %2
  %31 = load ptr, ptr %4, align 8, !tbaa !5
  %32 = getelementptr inbounds %"struct.Simd::InnerProductParam16b", ptr %31, i32 0, i32 7
  %33 = load i32, ptr %32, align 8, !tbaa !28
  %34 = icmp ne i32 %33, 0
  br i1 %34, label %35, label %45

35:                                               ; preds = %30, %2
  %36 = load ptr, ptr %4, align 8, !tbaa !5
  %37 = getelementptr inbounds %"struct.Simd::InnerProductParam16b", ptr %36, i32 0, i32 6
  %38 = load i32, ptr %37, align 4, !tbaa !29
  %39 = icmp ne i32 %38, 0
  br i1 %39, label %40, label %42

40:                                               ; preds = %35
  %41 = getelementptr inbounds %"class.Simd::Base::SynetInnerProduct16bGemmNN", ptr %5, i32 0, i32 3
  store ptr @_ZN4Simd4BaseL31InnerProduct16bGemmNN_ConvertBtEPKhRKNS_20InnerProductParam16bERKNS0_26SynetInnerProduct16bGemmNN8AlgParamEmmPt, ptr %41, align 8, !tbaa !25
  br label %44

42:                                               ; preds = %35
  %43 = getelementptr inbounds %"class.Simd::Base::SynetInnerProduct16bGemmNN", ptr %5, i32 0, i32 3
  store ptr @_ZN4Simd4BaseL31InnerProduct16bGemmNN_ConvertBnEPKhRKNS_20InnerProductParam16bERKNS0_26SynetInnerProduct16bGemmNN8AlgParamEmmPt, ptr %43, align 8, !tbaa !25
  br label %44

44:                                               ; preds = %42, %40
  br label %45

45:                                               ; preds = %44, %30
  ret void
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4Simd20SynetInnerProduct16bC2ERKNS_20InnerProductParam16bE(ptr noundef nonnull align 8 dereferenceable(160), ptr noundef nonnull align 8 dereferenceable(48)) unnamed_addr #0 align 2

; 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: mustprogress uwtable
declare hidden void @_ZN4Simd4BaseL31InnerProduct16bGemmNN_ConvertBtEPKhRKNS_20InnerProductParam16bERKNS0_26SynetInnerProduct16bGemmNN8AlgParamEmmPt(ptr noundef, ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(120), i64 noundef, i64 noundef, ptr noundef) #0

; Function Attrs: mustprogress uwtable
declare hidden void @_ZN4Simd4BaseL31InnerProduct16bGemmNN_ConvertBnEPKhRKNS_20InnerProductParam16bERKNS0_26SynetInnerProduct16bGemmNN8AlgParamEmmPt(ptr noundef, ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(120), i64 noundef, i64 noundef, ptr noundef) #0

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) }

!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 = !{!"vtable pointer", !8, i64 0}
!11 = !{!12, !6, i64 280}
!12 = !{!"_ZTSN4Simd4Base26SynetInnerProduct16bGemmNNE", !13, i64 0, !24, i64 160, !6, i64 280, !6, i64 288, !6, i64 296}
!13 = !{!"_ZTSN4Simd20SynetInnerProduct16bE", !14, i64 0, !15, i64 8, !19, i64 56, !20, i64 72, !21, i64 88, !22, i64 104, !16, i64 136, !16, i64 144, !16, i64 152}
!14 = !{!"_ZTSN4Simd9DeletableE"}
!15 = !{!"_ZTSN4Simd20InnerProductParam16bE", !16, i64 0, !16, i64 8, !16, i64 16, !17, i64 24, !17, i64 28, !17, i64 32, !18, i64 36, !18, i64 40, !18, i64 44}
!16 = !{!"long", !7, i64 0}
!17 = !{!"_ZTS18SimdTensorDataType", !7, i64 0}
!18 = !{!"_ZTS8SimdBool", !7, i64 0}
!19 = !{!"_ZTSN4Simd5ArrayIhEE", !6, i64 0, !16, i64 8}
!20 = !{!"_ZTSN4Simd5ArrayItEE", !6, i64 0, !16, i64 8}
!21 = !{!"_ZTSN4Simd5ArrayIfEE", !6, i64 0, !16, i64 8}
!22 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !23, i64 0, !16, i64 8, !7, i64 16}
!23 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !6, i64 0}
!24 = !{!"_ZTSN4Simd4Base26SynetInnerProduct16bGemmNN8AlgParamE", !16, i64 0, !16, i64 8, !16, i64 16, !16, i64 24, !16, i64 32, !16, i64 40, !16, i64 48, !16, i64 56, !16, i64 64, !16, i64 72, !16, i64 80, !16, i64 88, !16, i64 96, !16, i64 104, !16, i64 112}
!25 = !{!12, !6, i64 288}
!26 = !{!12, !6, i64 296}
!27 = !{!15, !17, i64 28}
!28 = !{!15, !18, i64 40}
!29 = !{!15, !18, i64 36}


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

@_ZTVN4Simd4Base26SynetInnerProduct16bGemmNNE = external dso_local unnamed_addr constant { [10 x ptr] }, align 8

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4Simd4Base26SynetInnerProduct16bGemmNNC2ERKNS_20InnerProductParam16bE(ptr noundef nonnull align 8 dereferenceable(304) %0, ptr noundef nonnull align 8 dereferenceable(48) %1) unnamed_addr #0 align 2 {
  tail call void @_ZN4Simd20SynetInnerProduct16bC2ERKNS_20InnerProductParam16bE(ptr noundef nonnull align 8 dereferenceable(160) %0, ptr noundef nonnull align 8 dereferenceable(48) %1)
  store ptr getelementptr inbounds inrange(-16, 64) (i8, ptr @_ZTVN4Simd4Base26SynetInnerProduct16bGemmNNE, i64 16), ptr %0, align 8, !tbaa !5
  %3 = getelementptr inbounds i8, ptr %0, i64 160
  %4 = getelementptr inbounds i8, ptr %1, i64 28
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(144) %3, i8 0, i64 144, i1 false)
  %5 = load i32, ptr %4, align 4, !tbaa !8
  %6 = icmp ne i32 %5, 0
  %7 = getelementptr inbounds i8, ptr %1, i64 40
  %8 = load i32, ptr %7, align 8
  %.not = icmp eq i32 %8, 0
  %or.cond = select i1 %6, i1 %.not, i1 false
  br i1 %or.cond, label %12, label %.sink.split

.sink.split:                                      ; preds = %2
  %9 = getelementptr inbounds i8, ptr %0, i64 288
  %10 = getelementptr inbounds i8, ptr %1, i64 36
  %11 = load i32, ptr %10, align 4, !tbaa !14
  %.not5 = icmp eq i32 %11, 0
  %_ZN4Simd4BaseL31InnerProduct16bGemmNN_ConvertBnEPKhRKNS_20InnerProductParam16bERKNS0_26SynetInnerProduct16bGemmNN8AlgParamEmmPt._ZN4Simd4BaseL31InnerProduct16bGemmNN_ConvertBtEPKhRKNS_20InnerProductParam16bERKNS0_26SynetInnerProduct16bGemmNN8AlgParamEmmPt = select i1 %.not5, ptr @_ZN4Simd4BaseL31InnerProduct16bGemmNN_ConvertBnEPKhRKNS_20InnerProductParam16bERKNS0_26SynetInnerProduct16bGemmNN8AlgParamEmmPt, ptr @_ZN4Simd4BaseL31InnerProduct16bGemmNN_ConvertBtEPKhRKNS_20InnerProductParam16bERKNS0_26SynetInnerProduct16bGemmNN8AlgParamEmmPt
  store ptr %_ZN4Simd4BaseL31InnerProduct16bGemmNN_ConvertBnEPKhRKNS_20InnerProductParam16bERKNS0_26SynetInnerProduct16bGemmNN8AlgParamEmmPt._ZN4Simd4BaseL31InnerProduct16bGemmNN_ConvertBtEPKhRKNS_20InnerProductParam16bERKNS0_26SynetInnerProduct16bGemmNN8AlgParamEmmPt, ptr %9, align 8, !tbaa !15
  br label %12

12:                                               ; preds = %.sink.split, %2
  ret void
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4Simd20SynetInnerProduct16bC2ERKNS_20InnerProductParam16bE(ptr noundef nonnull align 8 dereferenceable(160), ptr noundef nonnull align 8 dereferenceable(48)) unnamed_addr #0 align 2

; 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 uwtable
declare hidden void @_ZN4Simd4BaseL31InnerProduct16bGemmNN_ConvertBtEPKhRKNS_20InnerProductParam16bERKNS0_26SynetInnerProduct16bGemmNN8AlgParamEmmPt(ptr noundef, ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(120), i64 noundef, i64 noundef, ptr noundef) #0

; Function Attrs: mustprogress uwtable
declare hidden void @_ZN4Simd4BaseL31InnerProduct16bGemmNN_ConvertBnEPKhRKNS_20InnerProductParam16bERKNS0_26SynetInnerProduct16bGemmNN8AlgParamEmmPt(ptr noundef, ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(120), i64 noundef, i64 noundef, ptr noundef) #0

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) }

!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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !12, i64 28}
!9 = !{!"_ZTSN4Simd20InnerProductParam16bE", !10, i64 0, !10, i64 8, !10, i64 16, !12, i64 24, !12, i64 28, !12, i64 32, !13, i64 36, !13, i64 40, !13, i64 44}
!10 = !{!"long", !11, i64 0}
!11 = !{!"omnipotent char", !7, i64 0}
!12 = !{!"_ZTS18SimdTensorDataType", !11, i64 0}
!13 = !{!"_ZTS8SimdBool", !11, i64 0}
!14 = !{!9, !13, i64 36}
!15 = !{!16, !20, i64 288}
!16 = !{!"_ZTSN4Simd4Base26SynetInnerProduct16bGemmNNE", !17, i64 0, !25, i64 160, !20, i64 280, !20, i64 288, !20, i64 296}
!17 = !{!"_ZTSN4Simd20SynetInnerProduct16bE", !18, i64 0, !9, i64 8, !19, i64 56, !21, i64 72, !22, i64 88, !23, i64 104, !10, i64 136, !10, i64 144, !10, i64 152}
!18 = !{!"_ZTSN4Simd9DeletableE"}
!19 = !{!"_ZTSN4Simd5ArrayIhEE", !20, i64 0, !10, i64 8}
!20 = !{!"any pointer", !11, i64 0}
!21 = !{!"_ZTSN4Simd5ArrayItEE", !20, i64 0, !10, i64 8}
!22 = !{!"_ZTSN4Simd5ArrayIfEE", !20, i64 0, !10, i64 8}
!23 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !24, i64 0, !10, i64 8, !11, i64 16}
!24 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !20, i64 0}
!25 = !{!"_ZTSN4Simd4Base26SynetInnerProduct16bGemmNN8AlgParamE", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !10, i64 56, !10, i64 64, !10, i64 72, !10, i64 80, !10, i64 88, !10, i64 96, !10, i64 104, !10, i64 112}


; Effective O3 passes: EarlyCSEPass,InferFunctionAttrsPass,InstCombinePass,MemCpyOptPass,SROAPass,SimplifyCFGPass,TailCallElimPass